Quantcast
Channel: grep pattern and the content after that, and remove others - Unix & Linux Stack Exchange
Browsing latest articles
Browse All 2 View Live

Answer by Stephen Harris for grep pattern and the content after that, and...

sed would seem to be the right task for this: % sed -n 's/.* \(iwantthis\) .* \(url=[^ ]*\) .*/\1 \2/p' url.txt iwantthis url=https://www.google.com iwantthis url=yahoo.com How this works: -n -- only...

View Article



grep pattern and the content after that, and remove others

I'm having a problem to grep specific keyword and its content. This is sample file, the actual file is larger than this. Example user@linux:~$ cat url.txt abcrandomtextdef another random text...

View Article
Browsing latest articles
Browse All 2 View Live




Latest Images