Tag Info

New answers tagged

1

If you use / for separators, then you'll have to escape every / in your path, ex sed 's/\/some\/path/'$replacement'/g' Fortunately sed - like Perl - allows many characters to be used as separators, so you can also write sed 's#/some/path#'$replacement'#g' (the g flag is used to allow replacing multiple occurrences per line). Also sed will not allow ...


2

Escaping special char / is an option. You can also change the default sed separator (which is /) by using ? for example : another_unix_path="/another/unix/path" echo /some/path/file.txt | sed -e 's?/some/path/file.txt?'$another_unix_path'?g' The char used just after the s flag defines which separator will be used : s? Edit : #!/bin/sh ...


-1

You need to escape special characters: another_unix_path="\/another\/unix\/path" echo /some/path/file.txt | sed -e 's/\/some\/path\/file.txt/'$another_unix_path'/g' Which outputs this result: /another/unix/path


1

You can filter using the utility lshw, itself: lshw -C cpu That prints only the cpu part. But if you only want the product part then you need awk: lshw -C cpu | awk '$1=="product:"{$1=""; print}' It searches for the string product: in the first field variable and removes that part before printing the rest of the line.



Top 50 recent answers are included