In the below command,
cat abc.txt|awk -F"[0-9]+." '{print FS $3}'
Here FS
prints [0-9]+.
. However, I want the awk
to print the matched value by that field separator e.g. "99." . Any idea how can I do it?
Say abc.txt
has this below. I want to separate second sentences using number. as FS
and print that number. in the output. basically want to print the value of FS
…such need came across in several places.
14. Animals 20. features
1. tiger 1. wild animal
2. cat 2. domestic animal
3. parrot 3. bird with wings
Best Answer
You don't want the value of
FS
; you want the string which matchedFS
(which can be different strings on the same line):