Bash sed: Difference between revisions

From I Will Fear No Evil
Jump to navigation Jump to search
(Created page with "==== Useful sed commands ==== cat foo | sed "1,/^stringMatch/d" * Will ignore all before string match until EOF * stringMatch must be start of line (^) Category:bash")
 
mNo edit summary
Line 3: Line 3:
* Will ignore all before string match until EOF
* Will ignore all before string match until EOF
* stringMatch must be start of line (^)
* stringMatch must be start of line (^)
cat foo | sed "/^stringMatch2/q" | grep -v "^stringMatch2"
* will match ALL until match ( and remove match string LINE)


[[Category:bash]]
[[Category:bash]]

Revision as of 15:01, 14 June 2022

Useful sed commands

cat foo | sed "1,/^stringMatch/d"

  • Will ignore all before string match until EOF
  • stringMatch must be start of line (^)

cat foo | sed "/^stringMatch2/q" | grep -v "^stringMatch2"

  • will match ALL until match ( and remove match string LINE)