Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How do set the delimiter to " when using AWK in linux

So I have a text file with

"sam", "james", "john"
"luke", "polly", "jack"

I am looking for an awk command that will isolate each name. I seem to be running into the issue that awk does not like me setting " as the delimiter

I would like it to look like

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

sam
luke

if I were to try and print field 0

I have tried these commands

awk -F""" '{print $0}' test.txt
awk -F"\"" '{print $0}' test.txt
awk -F'"' '{print $0}' test.txt
awk -F'\"' '{print $0}' test.txt
awk -F" '{print $0}' test.txt

None of those seems to have worked. This is my first time asking a question on here. Also started learning to code about 5 weeks ago as well 😀 so I hope this makes sense, isn’t a dumb question and that I formatted it all correctly!

>Solution :

With your shown samples please try following. Basically you need to print the correct field number here to get your expected output. That field number would be 2nd field.

awk -F'"' '{print $2}' Input_file
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading