What does this command mean: awk -F'/BaseCalls/' '{print $2}'?

Please explain what does this command mean?

awk -F'/BaseCalls/' '{print $2}'

I know -F tells awk to use(colon) as field separator. and '{print $2}' means print the second field (the fields being separated by :)

Is it trying to read the filenames in the /Basecalls/directory or process the files and read data present inside the files in the /Basecalls/ directory.

1 Answer

It says print the second column while the delimiter (field separator) is: '/BaseCalls/'.

  • -F means field separator, what is going to separate my fields? is it a colon? is it a "x" character or something else? and here we are telling awk that the string "/BaseCalls/" is our field separator.

In a file with a content similar to:

foo/BaseCalls/bar
zee/BaseCalls/baz

it will print:

bar
baz

If I use it like awk -F:, now it means that my field separator is a colon, which will be used on a data like:

foo:bar
zee:baz

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like