-2

I had three sed commands which are

sed 's/"//g'
sed 's/  *//g'
echo $1 | sed 's/.*'$2':\([^,}]*\).*/\1/'

How can I combine the above three sed commands together?

fredtantini
  • 14,608
  • 7
  • 46
  • 54

2 Answers2

2

You can combine multiple commands using -e

For example :

sed -e 'command' -e 'command'

Hope this helps .

Kalanidhi
  • 4,462
  • 24
  • 42
3Demon
  • 560
  • 3
  • 9
1

To join sed command, you can also use ; without the -e like this:

sed 'code;code;code' file

eks:

sed 's/"//g;s/  *//g' file
Jotne
  • 39,326
  • 11
  • 49
  • 54