0

I want to execute 2 ex commands using a shell script. For example: on a file called test Print lines containing .jsp.

:/.jsp/ p 

Add * to the beginning of those lines.

:s/^/\*/

How can I make a shell script that executes them both? I've tried a couple of things, but the second command is never executed. It only does the first command.

iruvar
  • 22,736
  • 7
  • 53
  • 82

1 Answers1

0

One way is to print using and update using

sed -n '/jsp/p' test;ex -c 'g/jsp/ s/^/*/' -c 'wq' test
iruvar
  • 22,736
  • 7
  • 53
  • 82