<?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: Awk field seperator in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021506#M97181</link>
    <description>I have another question?&lt;BR /&gt;&lt;BR /&gt;I would like to get only the first line from the output? (whatever the output might be).&lt;BR /&gt;&lt;BR /&gt;awk '/'hell'/ &amp;amp;&amp;amp; !/awk/ {print&lt;BR /&gt;$3}' /tmp/target.txt&lt;BR /&gt;HH&lt;BR /&gt;HH&lt;BR /&gt;HH&lt;BR /&gt;HH</description>
    <pubDate>Wed, 10 Jan 2007 21:58:21 GMT</pubDate>
    <dc:creator>maliaka</dc:creator>
    <dc:date>2007-01-10T21:58:21Z</dc:date>
    <item>
      <title>Awk field seperator</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021489#M97164</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;echo hello1 192.168.1.9|awk 'BEGIN { FS = "." } ; { print $1"."$2"."$3}'&lt;BR /&gt;hello1 192.168.1&lt;BR /&gt;&lt;BR /&gt;I only need to pring the first three octats from the second field and delete the first field (hello1).&lt;BR /&gt;&lt;BR /&gt;The echo string is an output from a loop.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 08 Jan 2007 00:43:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021489#M97164</guid>
      <dc:creator>maliaka</dc:creator>
      <dc:date>2007-01-08T00:43:13Z</dc:date>
    </item>
    <item>
      <title>Re: Awk field seperator</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021490#M97165</link>
      <description>Shalom, &lt;BR /&gt;&lt;BR /&gt;I have some non awk code that I was given on ITRC that does this job.&lt;BR /&gt;&lt;BR /&gt;IP=`expr "${LINE}" : ".*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\).*"`&lt;BR /&gt;&lt;BR /&gt;The expression above grabs the first three octets of an ip address.&lt;BR /&gt;&lt;BR /&gt;It doesn't use awk though.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Mon, 08 Jan 2007 01:01:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021490#M97165</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2007-01-08T01:01:07Z</dc:date>
    </item>
    <item>
      <title>Re: Awk field seperator</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021491#M97166</link>
      <description>Hey, there is some awk code after all.&lt;BR /&gt;&lt;BR /&gt;    OCT1=`echo $IP | awk -F. '{print $1}'`&lt;BR /&gt;    OCT2=`echo $IP | awk -F. '{print $2}'`&lt;BR /&gt;    OCT3=`echo $IP | awk -F. '{print $3}'`&lt;BR /&gt;    IPB=`echo $OCT1.$OCT2.$OCT3`&lt;BR /&gt;&lt;BR /&gt;After what I posted.&lt;BR /&gt;&lt;BR /&gt;Sorry for splitting the post, it was not intentional. Please provide me the slapping I so richly deserve in the point assignment phase(e.g. don't assign to both posts).&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Mon, 08 Jan 2007 01:11:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021491#M97166</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2007-01-08T01:11:57Z</dc:date>
    </item>
    <item>
      <title>Re: Awk field seperator</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021492#M97167</link>
      <description>I know that I can use echo strings to split the fields as much as I know there is away to do all of that in one line.&lt;BR /&gt;&lt;BR /&gt;10 points for the right answer.</description>
      <pubDate>Mon, 08 Jan 2007 01:20:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021492#M97167</guid>
      <dc:creator>maliaka</dc:creator>
      <dc:date>2007-01-08T01:20:50Z</dc:date>
    </item>
    <item>
      <title>Re: Awk field seperator</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021493#M97168</link>
      <description>Try This one&lt;BR /&gt;&lt;BR /&gt;echo hello1 192.168.1.9 | awk 'BEGIN { FS = "." } ; { print substr($1,8,11)"."$2"."$3}'&lt;BR /&gt;&lt;BR /&gt;result&lt;BR /&gt;&lt;BR /&gt;192.168.1&lt;BR /&gt;</description>
      <pubDate>Mon, 08 Jan 2007 04:34:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021493#M97168</guid>
      <dc:creator>albanese</dc:creator>
      <dc:date>2007-01-08T04:34:32Z</dc:date>
    </item>
    <item>
      <title>Re: Awk field seperator</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021494#M97169</link>
      <description>&lt;!--!*#--&gt;It gives the same output the previous one has an extra character. but doest make a difference.&lt;BR /&gt;&lt;BR /&gt;echo hello1 192.168.1.9 | awk 'BEGIN { FS = "." } ; { print substr($1,8,10)"."$2"."$3}'</description>
      <pubDate>Mon, 08 Jan 2007 04:49:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021494#M97169</guid>
      <dc:creator>albanese</dc:creator>
      <dc:date>2007-01-08T04:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: Awk field seperator</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021495#M97170</link>
      <description>pls try:&lt;BR /&gt;&lt;BR /&gt;echo hello1 192.168.1.9 | awk '{print $2}' |&lt;BR /&gt;awk -F"." '{print $1"."$2"."$3}'&lt;BR /&gt;&lt;BR /&gt;output should be:&lt;BR /&gt;&lt;BR /&gt;192.168.1&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;rgds</description>
      <pubDate>Mon, 08 Jan 2007 05:24:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021495#M97170</guid>
      <dc:creator>Yarek</dc:creator>
      <dc:date>2007-01-08T05:24:13Z</dc:date>
    </item>
    <item>
      <title>Re: Awk field seperator</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021496#M97171</link>
      <description>echo hello1 192.168.1.9 | cut -d' ' -f 2 | cut -d'.' -f1-3</description>
      <pubDate>Mon, 08 Jan 2007 06:52:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021496#M97171</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2007-01-08T06:52:54Z</dc:date>
    </item>
    <item>
      <title>Re: Awk field seperator</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021497#M97172</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;because the first field is 'hello1 192' in respect to the filed delimiter '.', you get what awk was told to do.&lt;BR /&gt;&lt;BR /&gt;echo hello1 192.168.1.9|awk '{split($2,a,"."); printf("%s.%s.%s\n" a[1],a[2],a[3])}'&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Mon, 08 Jan 2007 07:11:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021497#M97172</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2007-01-08T07:11:33Z</dc:date>
    </item>
    <item>
      <title>Re: Awk field seperator</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021498#M97173</link>
      <description>HI:&lt;BR /&gt;&lt;BR /&gt;# echo hello1 192.168.1.9|awk -F"[ .]" 'BEGIN{OFS="."};{print $2,$3,$4&amp;gt;&lt;BR /&gt;&lt;BR /&gt;192.168.1&lt;BR /&gt;&lt;BR /&gt;Note that the input field separator is a character class consisting of a space (blank) or a dot (".").&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 08 Jan 2007 07:56:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021498#M97173</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-01-08T07:56:34Z</dc:date>
    </item>
    <item>
      <title>Re: Awk field seperator</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021499#M97174</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Change awk's field separator regex to recognize both . and space.&lt;BR /&gt;&lt;BR /&gt;$ echo hello1 192.168.1.9 | awk -F'[. ]' '{print $2"."$3"."$4}'&lt;BR /&gt;192.168.1&lt;BR /&gt;&lt;BR /&gt;PCS</description>
      <pubDate>Mon, 08 Jan 2007 08:01:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021499#M97174</guid>
      <dc:creator>spex</dc:creator>
      <dc:date>2007-01-08T08:01:24Z</dc:date>
    </item>
    <item>
      <title>Re: Awk field seperator</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021500#M97175</link>
      <description>Very nice spex - definately a 10 in my books! &lt;BR /&gt;&lt;BR /&gt;I would have just piped through 2 awk statements - forgot about regex.&lt;BR /&gt;&lt;BR /&gt;IE:&lt;BR /&gt;&lt;BR /&gt;echo hello1 192.168.1.9 | awk '{print $2}' | awk -F. '{print $1"."$2"."$3}'&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff</description>
      <pubDate>Mon, 08 Jan 2007 09:50:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021500#M97175</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2007-01-08T09:50:14Z</dc:date>
    </item>
    <item>
      <title>Re: Awk field seperator</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021501#M97176</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;Well, it appears that Spex and I agree on the solution :-))&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 08 Jan 2007 10:20:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021501#M97176</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-01-08T10:20:22Z</dc:date>
    </item>
    <item>
      <title>Re: Awk field seperator</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021502#M97177</link>
      <description>I would use a -F [ .] solution.&lt;BR /&gt;But you could take the default whitespace field seperator and substitute a period followed by numbers at the end of $2 with nothing:&lt;BR /&gt;&lt;BR /&gt;awk '{sub (/.[0-9]+$/,"",$2); print $2}'&lt;BR /&gt;&lt;BR /&gt;Or you can 'match' the first 3 groups of numbers seperated by a period and print that.&lt;BR /&gt;That would allow this to work in free formatted text, not just on 'the second field'.&lt;BR /&gt;&lt;BR /&gt;awk '{match($0,/[0-9]+\.[0-9]+\.[0-9]+/); print substr($0,RSTART,RLENGTH)}'&lt;BR /&gt;&lt;BR /&gt;Enjoy,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 08 Jan 2007 12:49:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021502#M97177</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-01-08T12:49:38Z</dc:date>
    </item>
    <item>
      <title>Re: Awk field seperator</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021503#M97178</link>
      <description>I prefer  James R. Ferguson Solution.. Cheers.</description>
      <pubDate>Tue, 09 Jan 2007 05:24:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021503#M97178</guid>
      <dc:creator>albanese</dc:creator>
      <dc:date>2007-01-09T05:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: Awk field seperator</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021504#M97179</link>
      <description>Thanks a lot for the great solutions.&lt;BR /&gt;&lt;BR /&gt;Have you guys tried to double quote the echo string?&lt;BR /&gt;By default the -F,FS and OFS are a space character so if you put the echo string in double quote, it preserves the white space and therefore mess it up if add spaces. Try it.&lt;BR /&gt;&lt;BR /&gt;Hein has provided the best solution so far!!!&lt;BR /&gt;&lt;BR /&gt;Open for debate.</description>
      <pubDate>Tue, 09 Jan 2007 20:20:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021504#M97179</guid>
      <dc:creator>maliaka</dc:creator>
      <dc:date>2007-01-09T20:20:44Z</dc:date>
    </item>
    <item>
      <title>Re: Awk field seperator</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021505#M97180</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;the result of&lt;BR /&gt;echo a b | prog&lt;BR /&gt;echo 'a b' | prog&lt;BR /&gt;echo "a b" | prog&lt;BR /&gt;&lt;BR /&gt;or&lt;BR /&gt;prog $(echo a b)&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;will be the same.  In the view of the 'echo' command, it's different - in the first case it sees two parameters, in the other one parameter. But the result is the same: 'echo' will send the two parameters to its output, seperated by a space - which is exactly the same in case 2 or 3, where the space is taken from the original input of the single parameter. &lt;BR /&gt;&lt;BR /&gt;Different will be a scenario like this:&lt;BR /&gt;echo a&lt;TAB&gt;b&lt;BR /&gt;echo 'a&lt;TAB&gt;b'&lt;BR /&gt;&lt;BR /&gt;Only in the first case the result would NOT contain a TAB, but a space!&lt;BR /&gt;&lt;BR /&gt;mfG Peter&lt;/TAB&gt;&lt;/TAB&gt;</description>
      <pubDate>Wed, 10 Jan 2007 04:58:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021505#M97180</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2007-01-10T04:58:00Z</dc:date>
    </item>
    <item>
      <title>Re: Awk field seperator</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021506#M97181</link>
      <description>I have another question?&lt;BR /&gt;&lt;BR /&gt;I would like to get only the first line from the output? (whatever the output might be).&lt;BR /&gt;&lt;BR /&gt;awk '/'hell'/ &amp;amp;&amp;amp; !/awk/ {print&lt;BR /&gt;$3}' /tmp/target.txt&lt;BR /&gt;HH&lt;BR /&gt;HH&lt;BR /&gt;HH&lt;BR /&gt;HH</description>
      <pubDate>Wed, 10 Jan 2007 21:58:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021506#M97181</guid>
      <dc:creator>maliaka</dc:creator>
      <dc:date>2007-01-10T21:58:21Z</dc:date>
    </item>
    <item>
      <title>Re: Awk field seperator</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021507#M97182</link>
      <description>to get the first line of the output, no matter what it may be... just pipe it to head -1.&lt;BR /&gt;&lt;BR /&gt; awk '/'hell'/ &amp;amp;&amp;amp; !/awk/ {print $2}' /tmp/target.txt |head -1&lt;BR /&gt;&lt;BR /&gt;-denver</description>
      <pubDate>Wed, 10 Jan 2007 22:19:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021507#M97182</guid>
      <dc:creator>Denver Osborn</dc:creator>
      <dc:date>2007-01-10T22:19:27Z</dc:date>
    </item>
    <item>
      <title>Re: Awk field seperator</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021508#M97183</link>
      <description>also w/ awk using your syntax modified...&lt;BR /&gt;&lt;BR /&gt;awk 'NR&amp;gt;1{exit}/'hell'/ &amp;amp;&amp;amp; !/awk/ {print $3}' /tmp/target.txt&lt;BR /&gt;&lt;BR /&gt;-denver</description>
      <pubDate>Wed, 10 Jan 2007 22:32:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-field-seperator/m-p/5021508#M97183</guid>
      <dc:creator>Denver Osborn</dc:creator>
      <dc:date>2007-01-10T22:32:23Z</dc:date>
    </item>
  </channel>
</rss>

