SOLVED: How do I replace ' with sed....
I'm making a autoscan-script with scanimage and want to set up an "autofind-device", but I don't know how to replace ` or '
This is the scanimage command for listing supported devices: scanimage -L and the output is: Code:
device `hpaio:/usb/HP_LaserJet_3052?serial=00CNSKN09261' is a Hewlett-Packard HP_LaserJet_3052 all-in-one scanimage -L | sed 's/device \`/\n/' | sed s/\'/\n/' | awk 'NR==2' or scanimage -L | awk '/\`/,/\'/' So that the output is: hpaio:/usb/HP_LaserJet_3052?serial=00CNSKN09261 But I can't get sed (or awk) to remove/read the ` or the ' How can I do this? @ngelot |
Hi,
The ` does not need escaping: $ cat input | sed 's/device `/\n/' hpaio:/usb/HP_LaserJet_3052?serial=00CNSKN09261' is a Hewlett-Packard HP_LaserJet_3052 all-in-one Try using double qoutes for the second sed command: $ cat input | sed 's/device `/\n/' | sed "s/'/\n/" hpaio:/usb/HP_LaserJet_3052?serial=00CNSKN09261 is a Hewlett-Packard HP_LaserJet_3052 all-in-one Hope this helps. |
I was sure I tried double-quotes...
Anyway - this works: cat input | sed 's/device `//' | sed "s/'/\n/" | sed q Thanks! |
All times are GMT -5. The time now is 06:13 PM. |