Input file is like this:
Scene
some
text
...
Scene
some
more
text
And i want to be able to print the text between each 'Scene' (by printing $0, $1, etc.. like a cut -d -f would do).
I tried a lot of things using awk but i don't understand how to make it work.
awk -F '^Scene' '{print $1}' file
prints the whole file,
awk '/^Scène/{ print $1 } file'
prints all the Scene
it finds in the file.
i think i fail to understand the logic with awk.
Using gnu awk you can set a custom record separator:
awk -v RS='Scene[[:space:]]*' 'NF' file
some
text
...
some
more
text
-v RS='Scene[[:space:]]*'
will set input record separator as Scene
followed by optional white-spaces.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.