Thread
:
Your Favorite Apps/Mods NOT In Repositories
View Single Post
vandys
2013-02-19 , 17:12
Posts: 78 | Thanked: 109 times | Joined on Jan 2012 @ Washington State
#
54
Originally Posted by
Addison
All I would like is to also get rid of all the "|> " and """ characters as well if this is possible.
Yes, grep is line oriented. To rewrite parts of lines, we use "sed" instead:
command | sed 's/|>//' > outfile.txt
Would remove the first "|>" sequence it found in each line. If you want to remove *all* such, it's 's/|>//g' (g suffix to sed substitute command).
sed can also remove whole lines:
command | sed '/foobar/d'
Matches line with "foobar" within them and deletes them. I point this out because sed can run with a whole list of rules (provided by a file) and thus can probably do all your folding, spindling, and mutilating with a single "sed" command. If the file cleanup.sed had the two lines:
/Receiving/d
s/|>//g
Then running it with:
command | sed -f cleanup.sed > output.txt
Would both trim off lines with "Receiving" as well as remove the character sequence |> (without otherwise changing the line).
Andy
Quote & Reply
|
The Following 2 Users Say Thank You to vandys For This Useful Post:
Addison
,
Wikiwide
vandys
View Public Profile
Send a private message to vandys
Visit vandys's homepage!
Find all posts by vandys