csv - Ignoring embeded spaces with AWK -


I am searching in an easy way to print a specific field with the permission of the embedded spaces in the field.

Sample: field 1 field 2 "field three" field 4

I was able to equalize to 'code' awk '{print $ 3}' Want to be but do not give "Field Three" as a single field.

Update: More specifically, the fields should not be received later on $ 3, but the location in # 3 is messing things up $ 3 in the number of spaces between the quotes is the variable What is between quotes as a field, even if not all areas have been cited, I want to be able to cure it. Therefore, if among the quotation marks the fields are ignoring the spaces as a separator.

You can do this if there are double quotes always there:

  awk -F \ "'{print $ 2}'   

Specifically, I am saying awk that the field is separated from double quotes , The point at which you want it is easily available as field 2.

If you want to go to the latter areas, you can split the remaining line on the empty space, the new array, The field's F [] says, J From: <$ p>

  awk -F \ "'{split ($ 3, F," "); Print $ 2, F [1], F [2]} 'File Field Three Field 4 Field 5   

Believing your file looks like this:

  Field1 Field2 "Field Three" Field4 Field5 Field6    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -