in reply to Re^2: Delete a line from the file
in thread Delete a line from the file
A single quote may not occur between single quotes, even when preceded by a backslash.Hence - my previous suggestion is invalid - there is no "escaping" inside a single-quote.
Here is a shell trick to try:
Replace all perl-directed single quotes with that, and it should work.'"'"'
Extremely ugly, though. Here is how it works:
It starts in single quotes, and which you want a single quote you come out, go into double quotation to quote a single quote, then come out of double quotation, to go back into single quotes again.
Using this trick, your command passes the shell's syntax:
Update: I just noticed that my shell trick is identical to ikegami's (++) last example.perl -pi -e 's#\Q(.*)\$/'"'"',\$lines,\$matches))10.(.*)\$/'"'"',\$li +nes,\$matches))(.*)\$/'"'"',\$lines,\$matches))# #gi' result.txt > re +sult1.txt -- Output (from perl - bash is happy!!!) -- Can't open result.txt: No such file or directory.
Have you been high today? I see the nuns are gay! My brother yelled to me...I love you inside Ed - Benny Lava, by Buffalax
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Delete a line from the file
by ajd335 (Novice) on Jul 16, 2008 at 22:52 UTC | |
by NetWallah (Canon) on Jul 16, 2008 at 23:07 UTC | |
by ajd335 (Novice) on Jul 16, 2008 at 23:37 UTC | |
by NetWallah (Canon) on Jul 17, 2008 at 06:11 UTC | |
by Anonymous Monk on Jul 17, 2008 at 16:20 UTC |