Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Grep and append

$
0
0
Have a string as below in a file.

"
Code:

anohter boy has id 000921 and girl has id=655 of roll number
"

using grep below commands with grep commands but able to get one string at a time, not able to append.

Code:

less <filename> | grep -o -P '(?<=id ).*(?=and )'
Code:


less <filename> | grep -o -P '(?<=id\= ).*(?=of )'

how to get output as :
Code:

000921 655
thanks

Viewing all articles
Browse latest Browse all 16232

Trending Articles