<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How do I make awk select fields between quotes? in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/how-do-i-make-awk-select-fields-between-quotes/m-p/3791395#M99618</link>
    <description>Assuming your input file contains the records that you want parsed then here's an awk construct that does what you're looking for:&lt;BR /&gt;&lt;BR /&gt;# awk '{sub("\" \"","\"");FS="\"";print $1,$2,$3,$4}' infile&lt;BR /&gt;&lt;BR /&gt;cheers!</description>
    <pubDate>Sat, 20 May 2006 14:08:26 GMT</pubDate>
    <dc:creator>Sandman!</dc:creator>
    <dc:date>2006-05-20T14:08:26Z</dc:date>
    <item>
      <title>How do I make awk select fields between quotes?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-do-i-make-awk-select-fields-between-quotes/m-p/3791390#M99613</link>
      <description>Do you see how the 1st and 2nd share names in this list are "oneword" entries, but the 3rd and 4th contain spaces?&lt;BR /&gt;&lt;BR /&gt;I want awk to read all fields between quote marks as one field, but I also want a space to be a field seperator.  &lt;BR /&gt;&lt;BR /&gt;Can you do that?&lt;BR /&gt;&lt;BR /&gt;share "ERDisk" "/fs02/ERDisk" netbios=OH01PDMS01 maxusr=4294967295 umask=22&lt;BR /&gt;share "SPSBackup" "/fs01/SPSBackup" netbios=OH01PDMS01 maxusr=4294967295&lt;BR /&gt;share "Architect Team" "/fs01/Architect Team" netbios=OH01PDMS01&lt;BR /&gt;share "Storage Area Network" "/fs01/Storage" netbios=OH01PDMS01&lt;BR /&gt;</description>
      <pubDate>Fri, 19 May 2006 10:16:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-do-i-make-awk-select-fields-between-quotes/m-p/3791390#M99613</guid>
      <dc:creator>Stuart Abramson</dc:creator>
      <dc:date>2006-05-19T10:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: How do I make awk select fields between quotes?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-do-i-make-awk-select-fields-between-quotes/m-p/3791391#M99614</link>
      <description>Hi Stuart:&lt;BR /&gt;&lt;BR /&gt;Use 'split'.  For instance:&lt;BR /&gt;&lt;BR /&gt;# X='share "Storage Area Network" "/fs01/Storage" netbios=OH01PDMS01'&lt;BR /&gt;&lt;BR /&gt;# echo ${X}|awk -F\" '{WORD=split($2,a," ");print a[2]}' &lt;BR /&gt;&lt;BR /&gt;...prints:&lt;BR /&gt;&lt;BR /&gt;Area&lt;BR /&gt;&lt;BR /&gt;...or the second field of the second field.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 19 May 2006 10:24:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-do-i-make-awk-select-fields-between-quotes/m-p/3791391#M99614</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-05-19T10:24:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do I make awk select fields between quotes?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-do-i-make-awk-select-fields-between-quotes/m-p/3791392#M99615</link>
      <description>&lt;!--!*#--&gt;Awk isn't really good at parsing quoted&lt;BR /&gt;input.  There is no feature made just for&lt;BR /&gt;quoting input.  Here is an implementation&lt;BR /&gt;that uses the match() function to identify&lt;BR /&gt;pairs of quotes.  It then changes spaces&lt;BR /&gt;within the quotes to a placeholder character&lt;BR /&gt;that can be made back into a space after&lt;BR /&gt;splitting the line into fields.  You may&lt;BR /&gt;want to handle tab characters as well.&lt;BR /&gt;&lt;BR /&gt;$ cat quoting.awk&lt;BR /&gt;{&lt;BR /&gt;l=$0&lt;BR /&gt;q="\""&lt;BR /&gt;qsp="\377" # A character for quoted spaces&lt;BR /&gt;nq="[^\"]"&lt;BR /&gt;while (match(l, q nq "*" q)) { #find quote pairs&lt;BR /&gt; quoted=substr(l, RSTART, RLENGTH)&lt;BR /&gt; gsub(" ",qsp,quoted) #change spaces to quoted spaces inside quotes&lt;BR /&gt; gsub(q,"",quoted) #remove quotes&lt;BR /&gt; l2=substr(l, 1, RSTART-1) quoted substr(l, RSTART+RLENGTH)&lt;BR /&gt; l=l2 #reassemble line&lt;BR /&gt;}&lt;BR /&gt;print "parsing '" $0 "'"&lt;BR /&gt;nf=split(l, a)&lt;BR /&gt;for (i=1; i&amp;lt;=nf; i++) {&lt;BR /&gt;gsub(qsp," ",a[i]) # change quoted spaces back to spaces&lt;BR /&gt;print "field " i " is '" a[i] "'"&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;$ X='share "Storage Area   Network" "/fs01/Storage" netbios=OH01PDMS01'&lt;BR /&gt;$ echo "${X}" | awk -f quoting.awk&lt;BR /&gt;parsing 'share "Storage Area   Network" "/fs01/Storage" netbios=OH01PDMS01'&lt;BR /&gt;field 1 is 'share'&lt;BR /&gt;field 2 is 'Storage Area   Network'&lt;BR /&gt;field 3 is '/fs01/Storage'&lt;BR /&gt;field 4 is 'netbios=OH01PDMS01'&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 19 May 2006 12:16:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-do-i-make-awk-select-fields-between-quotes/m-p/3791392#M99615</guid>
      <dc:creator>Mike Stroyan</dc:creator>
      <dc:date>2006-05-19T12:16:42Z</dc:date>
    </item>
    <item>
      <title>Re: How do I make awk select fields between quotes?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-do-i-make-awk-select-fields-between-quotes/m-p/3791393#M99616</link>
      <description>Hi Stuart,&lt;BR /&gt;&lt;BR /&gt;Can you show how the output should look like? It's hard to figure out from your post what exactly you're trying to accomplish.&lt;BR /&gt;&lt;BR /&gt;thanks!</description>
      <pubDate>Fri, 19 May 2006 16:12:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-do-i-make-awk-select-fields-between-quotes/m-p/3791393#M99616</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-05-19T16:12:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do I make awk select fields between quotes?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-do-i-make-awk-select-fields-between-quotes/m-p/3791394#M99617</link>
      <description>&lt;!--!*#--&gt;I want to break this line:&lt;BR /&gt;&lt;BR /&gt;share "Architect Team" "/fs01/Architect Team" netbios=OH01PDMS01&lt;BR /&gt;&lt;BR /&gt;Into 4 fields:&lt;BR /&gt;&lt;BR /&gt;$1 = share&lt;BR /&gt;$2 = Architect Team&lt;BR /&gt;$3 = /fs01/Architect&lt;BR /&gt;$4 = netbios=OH01PDMS01&lt;BR /&gt;&lt;BR /&gt;Not that $2 has a space in it.  I could replace it with something distinctive, like "&amp;amp;".  This may not be possible...</description>
      <pubDate>Sat, 20 May 2006 11:04:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-do-i-make-awk-select-fields-between-quotes/m-p/3791394#M99617</guid>
      <dc:creator>Stuart Abramson</dc:creator>
      <dc:date>2006-05-20T11:04:47Z</dc:date>
    </item>
    <item>
      <title>Re: How do I make awk select fields between quotes?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-do-i-make-awk-select-fields-between-quotes/m-p/3791395#M99618</link>
      <description>Assuming your input file contains the records that you want parsed then here's an awk construct that does what you're looking for:&lt;BR /&gt;&lt;BR /&gt;# awk '{sub("\" \"","\"");FS="\"";print $1,$2,$3,$4}' infile&lt;BR /&gt;&lt;BR /&gt;cheers!</description>
      <pubDate>Sat, 20 May 2006 14:08:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-do-i-make-awk-select-fields-between-quotes/m-p/3791395#M99618</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-05-20T14:08:26Z</dc:date>
    </item>
    <item>
      <title>Re: How do I make awk select fields between quotes?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-do-i-make-awk-select-fields-between-quotes/m-p/3791396#M99619</link>
      <description>&lt;BR /&gt;I don't see a single function in AWK to do this.&lt;BR /&gt;You'll have to go through the motions.&lt;BR /&gt;The example below splits the whole line in words. It then starts building a array of 'tokens' which will be the target deliverable.&lt;BR /&gt;For each input word, copy it to the new array, detecting a word starting with a quote. If you do, then look for the first word ending in a quote allowing for that to be the same word.&lt;BR /&gt;As long as you do not see an end quote, keep adding words to the same token.&lt;BR /&gt;&lt;BR /&gt;Enjoy!&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;------ demonstration x.awk -----------&lt;BR /&gt;{&lt;BR /&gt;word_count=split ($0, words, " "); &lt;BR /&gt;n=1&lt;BR /&gt;for (i=1; i&amp;lt;=word_count; i++) {&lt;BR /&gt;  word = words[i];&lt;BR /&gt;  tokens[n]=word;&lt;BR /&gt;  if (index(word,"\"")==1) {&lt;BR /&gt;# drop leading double-quote to deal with quoted single words&lt;BR /&gt;    word = substr (word,2);&lt;BR /&gt;    while (index(word,"\"") != length(word)) {&lt;BR /&gt;      word = words[++i];&lt;BR /&gt;      tokens[n] = tokens[n] " " word; # single space.&lt;BR /&gt;      }&lt;BR /&gt;    }&lt;BR /&gt;  n++;&lt;BR /&gt;  }&lt;BR /&gt;#&lt;BR /&gt;# Finally we have all new tokens&lt;BR /&gt;#&lt;BR /&gt;print "\nInput #",NR, $0;&lt;BR /&gt;for (i=1; i&lt;N&gt;&lt;/N&gt;  print i, tokens[i];&lt;BR /&gt;  } &lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;------------ demonstration with data from original question&lt;BR /&gt;&lt;BR /&gt;# awk -f x.awk x.txt&lt;BR /&gt;&lt;BR /&gt;Input line # 1 share "ERDisk" "/fs02/ERDisk" netbios=OH01PDMS01 maxusr=4294967295 umask=22&lt;BR /&gt;1 share&lt;BR /&gt;2 "ERDisk"&lt;BR /&gt;3 "/fs02/ERDisk"&lt;BR /&gt;4 netbios=OH01PDMS01&lt;BR /&gt;5 maxusr=4294967295&lt;BR /&gt;6 umask=22&lt;BR /&gt;&lt;BR /&gt;Input line # 2 share "SPSBackup" "/fs01/SPSBackup" netbios=OH01PDMS01 maxusr=4294967295&lt;BR /&gt;1 share&lt;BR /&gt;2 "SPSBackup"&lt;BR /&gt;3 "/fs01/SPSBackup"&lt;BR /&gt;4 netbios=OH01PDMS01&lt;BR /&gt;5 maxusr=4294967295&lt;BR /&gt;&lt;BR /&gt;Input line # 3 share "Architect Team" "/fs01/Architect Team" netbios=OH01PDMS01&lt;BR /&gt;1 share&lt;BR /&gt;2 "Architect Team"&lt;BR /&gt;3 "/fs01/Architect Team"&lt;BR /&gt;4 netbios=OH01PDMS01&lt;BR /&gt;&lt;BR /&gt;Input line # 4 share "Storage Area Network" "/fs01/Storage" netbios=OH01PDMS01&lt;BR /&gt;1 share&lt;BR /&gt;2 "Storage Area Network"&lt;BR /&gt;3 "/fs01/Storage"&lt;BR /&gt;4 netbios=OH01PDMS01&lt;BR /&gt;&lt;BR /&gt;#</description>
      <pubDate>Sat, 20 May 2006 14:17:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-do-i-make-awk-select-fields-between-quotes/m-p/3791396#M99619</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2006-05-20T14:17:21Z</dc:date>
    </item>
    <item>
      <title>Re: How do I make awk select fields between quotes?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-do-i-make-awk-select-fields-between-quotes/m-p/3791397#M99620</link>
      <description>Hmmm, a reply by Sandman snuck in which looks interesting but I do not think it does the job.&lt;BR /&gt;&lt;BR /&gt;When we use that with a explicit labels we get:&lt;BR /&gt;&lt;BR /&gt;{print "input", NR, $0;&lt;BR /&gt; sub("\" \"","\"");&lt;BR /&gt; FS="\"";&lt;BR /&gt; print "1:", $1&lt;BR /&gt; print "2:", $2&lt;BR /&gt; print "3:", $3&lt;BR /&gt; print "4:", $4&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;----- demonstruction using the same input data ---&lt;BR /&gt;&lt;BR /&gt;# awk -f y.awk x.txt&lt;BR /&gt;input 1 share "ERDisk" "/fs02/ERDisk" netbios=OH01PDMS01 maxusr=4294967295 umask=22&lt;BR /&gt;1: share&lt;BR /&gt;2: "ERDisk"/fs02/ERDisk"&lt;BR /&gt;3: netbios=OH01PDMS01&lt;BR /&gt;4: maxusr=4294967295&lt;BR /&gt;input 2 share "SPSBackup" "/fs01/SPSBackup" netbios=OH01PDMS01 maxusr=4294967295&lt;BR /&gt;1: share&lt;BR /&gt;2: SPSBackup&lt;BR /&gt;3: /fs01/SPSBackup&lt;BR /&gt;4:  netbios=OH01PDMS01 maxusr=4294967295&lt;BR /&gt;input 3 share "Architect Team" "/fs01/Architect Team" netbios=OH01PDMS01&lt;BR /&gt;1: share&lt;BR /&gt;2: Architect Team&lt;BR /&gt;3: /fs01/Architect Team&lt;BR /&gt;4:  netbios=OH01PDMS01&lt;BR /&gt;input 4 share "Storage Area Network" "/fs01/Storage" netbios=OH01PDMS01&lt;BR /&gt;1: share&lt;BR /&gt;2: Storage Area Network&lt;BR /&gt;3: /fs01/Storage&lt;BR /&gt;4:  netbios=OH01PDMS01&lt;BR /&gt;&lt;BR /&gt;Not what was requested.&lt;BR /&gt;&lt;BR /&gt;Mind you, mine is also not exactly right, as I left the quotes.&lt;BR /&gt;Below a minor adaption to remove the quotes.&lt;BR /&gt;&lt;BR /&gt;----- x.awk removing quotes from tokens ---&lt;BR /&gt;{&lt;BR /&gt;word_count=split ($0, words, " "); &lt;BR /&gt;n=1&lt;BR /&gt;for (i=1; i&amp;lt;=word_count; i++) {&lt;BR /&gt;  word = words[i];&lt;BR /&gt;  tokens[n]=word;&lt;BR /&gt;  if (index(word,"\"")==1) {&lt;BR /&gt;# drop leading double-quote&lt;BR /&gt;    word = substr (word,2);&lt;BR /&gt;    tokens[n] = word;&lt;BR /&gt;    while (index(word,"\"") != length(word)) {&lt;BR /&gt;      word = words[++i];&lt;BR /&gt;      tokens[n] = tokens[n] " " word; # single space.&lt;BR /&gt;      }&lt;BR /&gt;# drop trailing quote&lt;BR /&gt;    tokens[n] = substr (tokens[n], 1, length(tokens[n]) - 1);&lt;BR /&gt;    }&lt;BR /&gt;  n++;&lt;BR /&gt;  }&lt;BR /&gt;#&lt;BR /&gt;# Finally proudly display new tokens.&lt;BR /&gt;#&lt;BR /&gt;print "\nInput #",NR, $0;&lt;BR /&gt;for (i=1; i&lt;N&gt;&lt;/N&gt;  print i, tokens[i];&lt;BR /&gt;  } &lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;--- demonstration --------&lt;BR /&gt;&lt;BR /&gt;# awk -f x.awk x.txt&lt;BR /&gt;&lt;BR /&gt;Input # 1 share "ERDisk" "/fs02/ERDisk" netbios=OH01PDMS01 maxusr=4294967295 umask=22&lt;BR /&gt;1 share&lt;BR /&gt;2 ERDisk&lt;BR /&gt;3 /fs02/ERDisk&lt;BR /&gt;4 netbios=OH01PDMS01&lt;BR /&gt;5 maxusr=4294967295&lt;BR /&gt;6 umask=22&lt;BR /&gt;&lt;BR /&gt;Input # 2 share "SPSBackup" "/fs01/SPSBackup" netbios=OH01PDMS01 maxusr=4294967295&lt;BR /&gt;1 share&lt;BR /&gt;2 SPSBackup&lt;BR /&gt;3 /fs01/SPSBackup&lt;BR /&gt;4 netbios=OH01PDMS01&lt;BR /&gt;5 maxusr=4294967295&lt;BR /&gt;&lt;BR /&gt;Input # 3 share "Architect Team" "/fs01/Architect Team" netbios=OH01PDMS01&lt;BR /&gt;1 share&lt;BR /&gt;2 Architect Team&lt;BR /&gt;3 /fs01/Architect Team&lt;BR /&gt;4 netbios=OH01PDMS01&lt;BR /&gt;&lt;BR /&gt;Input # 4 share "Storage Area Network" "/fs01/Storage" netbios=OH01PDMS01&lt;BR /&gt;1 share&lt;BR /&gt;2 Storage Area Network&lt;BR /&gt;3 /fs01/Storage&lt;BR /&gt;4 netbios=OH01PDMS01&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sat, 20 May 2006 14:32:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-do-i-make-awk-select-fields-between-quotes/m-p/3791397#M99620</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2006-05-20T14:32:12Z</dc:date>
    </item>
    <item>
      <title>Re: How do I make awk select fields between quotes?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-do-i-make-awk-select-fields-between-quotes/m-p/3791398#M99621</link>
      <description>Hein...the input file I used looks like:&lt;BR /&gt;&lt;BR /&gt;# cat infile&lt;BR /&gt;share "Architect Team" "/fs01/Architect Team" netbios=OH01PDMS01&lt;BR /&gt;share "Storage Area Network" "/fs01/Storage" netbios=OH01PDMS01&lt;BR /&gt;&lt;BR /&gt;and in order to see the fields one per line here's the revised code:&lt;BR /&gt;&lt;BR /&gt;# awk '{&lt;BR /&gt;&amp;gt; sub("\" \"","\"")&lt;BR /&gt;&amp;gt; FS="\""&lt;BR /&gt;&amp;gt; print "$1= "$1"\n$2= "$2"\n$3= "$3"\n$4= "$4"\n"&lt;BR /&gt;&amp;gt; }' infile&lt;BR /&gt;&lt;BR /&gt;the above awk construct outputs...&lt;BR /&gt;&lt;BR /&gt;$1= share&lt;BR /&gt;$2= Architect Team&lt;BR /&gt;$3= /fs01/Architect Team&lt;BR /&gt;$4=  netbios=OH01PDMS01&lt;BR /&gt;&lt;BR /&gt;$1= share&lt;BR /&gt;$2= Storage Area Network&lt;BR /&gt;$3= /fs01/Storage&lt;BR /&gt;$4=  netbios=OH01PDMS01&lt;BR /&gt;&lt;BR /&gt;...no double quotes in any of the fields&lt;BR /&gt;&lt;BR /&gt;regards!</description>
      <pubDate>Sat, 20 May 2006 14:42:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-do-i-make-awk-select-fields-between-quotes/m-p/3791398#M99621</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-05-20T14:42:10Z</dc:date>
    </item>
    <item>
      <title>Re: How do I make awk select fields between quotes?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-do-i-make-awk-select-fields-between-quotes/m-p/3791399#M99622</link>
      <description>&lt;!--!*#--&gt;You are right Sandman. &lt;BR /&gt;It does work for those two lines. &lt;BR /&gt;10 point for your clever solution for thsi specific case!&lt;BR /&gt;Of course it will split in only 4 fields, but that may well be desirable.&lt;BR /&gt;And of course it requires quoted fields 2 and 3, even if they are single words, but that is likely to be the case.&lt;BR /&gt;&lt;BR /&gt;The reason I replied is because it did NOT work on the first line, on my test (XP system).&lt;BR /&gt;&lt;BR /&gt;It turns out that when I copy that first line, it fails on the first instance, but works on the next! Bad luck?&lt;BR /&gt;&lt;BR /&gt;I then tried the same on a Linux box (no access to hpux just now) and the same effect?!&lt;BR /&gt;First line fails, but an identical second line works.&lt;BR /&gt;I'm at a loss for an explanation.&lt;BR /&gt;&lt;BR /&gt;For a more generic qoutes string handling I would probably turn to perl.&lt;BR /&gt;One approach would be to replace each quoted string with a recognizable word, then split and when you see a special word substitute the machting quoted string back:&lt;BR /&gt;&lt;BR /&gt;----------- x.pl -------------&lt;BR /&gt;$special = "special";&lt;BR /&gt;&lt;BR /&gt;print "Input #$NR $_";&lt;BR /&gt;$i = 0;&lt;BR /&gt;while (/\s(".*?")\s/) {&lt;BR /&gt;   $special{$special.$i} = substr($1, 1, length($1) - 2);&lt;BR /&gt;   s/$1/$special.$i++/e;&lt;BR /&gt;   }&lt;BR /&gt;&lt;BR /&gt;$j = 0;&lt;BR /&gt;foreach $word (split) {&lt;BR /&gt;   $word = $special{$word} if ($word =~ /^$special/);&lt;BR /&gt;   print ++$j, ": $word\n";&lt;BR /&gt;   }&lt;BR /&gt;------------------------&lt;BR /&gt;use as: perl -n x.pl x.txt&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Btw.. I only just noticed the new 'retain format' after I pushed 'submit'. &lt;BR /&gt;I'm going to use this re-reply to see how that would on my awk attempt.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;{&lt;BR /&gt;word_count=split ($0, words, " ");&lt;BR /&gt;n=1&lt;BR /&gt;for (i=1; i&amp;lt;=word_count; i++) {&lt;BR /&gt;  word = words[i];&lt;BR /&gt;  tokens[n]=word;&lt;BR /&gt;  if (index(word,"\"")==1) {&lt;BR /&gt;# drop leading double-quote&lt;BR /&gt;    word = substr (word,2);&lt;BR /&gt;    tokens[n] = word;&lt;BR /&gt;    while (index(word,"\"") != length(word)) {&lt;BR /&gt;      word = words[++i];&lt;BR /&gt;      tokens[n] = tokens[n] " " word; # single space.&lt;BR /&gt;      }&lt;BR /&gt;# drop trailing quote&lt;BR /&gt;    tokens[n] = substr (tokens[n], 1, length(tokens[n]) - 1);&lt;BR /&gt;    }&lt;BR /&gt;  n++;&lt;BR /&gt;  }&lt;BR /&gt;#&lt;BR /&gt;# Finally we have all new tokens&lt;BR /&gt;#&lt;BR /&gt;print "\nInput #",NR, $0;&lt;BR /&gt;for (i=1; i&lt;N&gt;&lt;/N&gt;  print i, tokens[i];&lt;BR /&gt;  }&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sat, 20 May 2006 15:55:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-do-i-make-awk-select-fields-between-quotes/m-p/3791399#M99622</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2006-05-20T15:55:08Z</dc:date>
    </item>
  </channel>
</rss>

