-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
  • 15,966
  • 8
  • 49
  • 55

2 Answers2

2

You can combine multiple commands using -e

For example :

sed -e 'command' -e 'command'

Hope this helps .

Kalanidhi
  • 4,902
  • 27
  • 42
3Demon
  • 550
  • 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
  • 40,548
  • 12
  • 51
  • 55