one more regex problem sorry
Hi, I want to match any strings like:
Code:
...contents... This is always at the start of the line, I have come up with a matching pattern, but this grabs the whole line instead of only "/tmp/1-MMmxI7E" Code:
echo "$(cat "/var/mail/root/torrents/81A3A9.torrent" | sed -n '/^Wrote file/{ /.*/p}' )" THanks, Ted |
Yeah you still need a removal:
Code:
sed -n '/^Wrote file/s|[^/]*//p' file |
edit: Nevermind, grail provided a shorter and better solution:)
|
thanks!
|
Quote:
the contents that I am tring to match is in the file "/var/mail/root/torrents/81A3A9.torrent" so it is actually: Code:
$ cat "/var/mail/root/torrents/81A3A9.torrent" Thanks! Ted |
Assuming the file name does not contain spaces:
Code:
sed -nr 's/Wrote file ([^[:space:]]+).*/\1/p' /var/mail/root/torrents/81A3A9.torrent |
Thank you!
|
My bad ... still had old copy stored in paste :( ... Should have been:
Code:
sed -n '/^Wrote file/s|[^/]*||p' file |
Hi, np, it works perfect too! Thanks!!
Ted |
All times are GMT -5. The time now is 08:03 PM. |