the string looks like (37°35'11.2" N 85°30'40.3"W)
grep does not work
grep -a "(37\°35\'11\.2\" N 85\°30\'40\.3\"W)" file.txt
grep "(37\°35\'11\.2\" N 85\°30\'40\.3\"W)" file.txt
grep -a "(37°35'11.2\" N 85°30'40.3\"W)" file.txt
CodePudding user response:
One more generic way (you can change \d
by numbers):
$ grep -P '\d .\d .\d .\d " N \d .\d .\d .\d ..' l
37°35'11.2" N 85°30'40.3"W
CodePudding user response:
I think your problem is that the \ character is being used to escape the °, ', and " characters, but this escape character is only recognized by the shell when it appears inside a string enclosed in single quotes ('). However, in your commands, the \ characters are not inside single quotes, so the shell is treating them as literal characters instead of escape characters.
Try:
grep -a '(37\°35\'11\.2" N 85\°30\'40\.3"W)' file.txt