Skip to main content
Tweeted twitter.com/StackUnix/status/768360174721572864
added 2 characters in body
Source Link
985ranch
  • 151
  • 2
  • 11

What is the best way to combine these two SED commands together? The first command searches for CSP and then moves down one line. The second command puts a semicolon in column 3.

sed -ne '/CSP/{n;n;p;}' test1>test2
sed 's/./;/3' test2>final

The command is needed to act upon one line of data and cannot be conducted separately.

What is the best way to combine these two SED commands together? The first command searches for CSP and then moves down one line. The second command puts a semicolon in column 3.

sed -ne '/CSP/{n;}' test1>test2
sed 's/./;/3' test2>final

The command is needed to act upon one line of data and cannot be conducted separately.

What is the best way to combine these two SED commands together? The first command searches for CSP and then moves down one line. The second command puts a semicolon in column 3.

sed -ne '/CSP/{n;p;}' test1>test2
sed 's/./;/3' test2>final

The command is needed to act upon one line of data and cannot be conducted separately.

Source Link
985ranch
  • 151
  • 2
  • 11

Combine SED commands

What is the best way to combine these two SED commands together? The first command searches for CSP and then moves down one line. The second command puts a semicolon in column 3.

sed -ne '/CSP/{n;}' test1>test2
sed 's/./;/3' test2>final

The command is needed to act upon one line of data and cannot be conducted separately.