Search word and delete only the word and the line using Sed command
Hi All,
Struck with this, please help. Want to search for ~ and delete it as well as to append the entire line to the above line. For Ex: 1111 xxxx date Sandy area is ~around this area. 3222 xxx date There seems to ~left side of map, the colours are accurate (showing green areas) Even if I ~zoom in, the green parks, xxx 3258 date The dammed up ~away, the "other" body of water varies ~black Natural gas leaching. IT MUST LOOK LIKE: 1111 xxxx date Sandy area is around this area. 3222 xxx date There seems to left side of map, the colours are accurate (showing green areas) Even if I zoom in, the green parks, xxx 3258 date The dammed up away, the "other" body of water varies black Natural gas leaching. |
This doesn't look like homework, so if it is, well done for obscuring it ;)
sed ':a;N;$!ba;s/\n/ /g' file.txt |
Hi,
acid_kewpie's example doesn't work on my side, this does: Code:
sed '/^~/!{:tag;N;s/\n~//;b tag}' infile |
Odd, fine for me. Maybe some whitespace issues aside.
|
Thanks to both of you.
"acid_kewpie" code doesn't work for me also and, "druuna" does. |
All times are GMT -5. The time now is 10:34 PM. |