Re: [PLUG] Gawk: skipping first line

2021-11-19 Thread Tomas Kuchta
Great resource, I use it frequently. On Fri, Nov 19, 2021, 14:34 Russell Senior wrote: > Did you look at this at all? > > https://www.gnu.org/software/gawk/manual/gawk.html > > It is similar to the original book, which I have on my shelf. > > On Fri, Nov 19, 2021 at 10:54 AM Rich Shepard >

Re: [PLUG] Gawk: skipping first line

2021-11-19 Thread Russell Senior
Did you look at this at all? https://www.gnu.org/software/gawk/manual/gawk.html It is similar to the original book, which I have on my shelf. On Fri, Nov 19, 2021 at 10:54 AM Rich Shepard wrote: > > On Fri, 19 Nov 2021, Robert Citek wrote: > > > So you want ‘NR > 1’ to be a pattern, but you

Re: [PLUG] Gawk: skipping first line

2021-11-19 Thread Tomas Kuchta
I answered the same a while back, with similar response. Time to try it! -T On Fri, Nov 19, 2021, 13:54 Rich Shepard wrote: > On Fri, 19 Nov 2021, Robert Citek wrote: > > > So you want ‘NR > 1’ to be a pattern, but you have it as an action. > > Your code needs to look more like this … > >

Re: [PLUG] Gawk: skipping first line

2021-11-19 Thread Rich Shepard
On Fri, 19 Nov 2021, Robert Citek wrote: So you want ‘NR > 1’ to be a pattern, but you have it as an action. Your code needs to look more like this … BEGIN { FS = ","; OFS = "," } NR > 1 { print $1, $2, $3, $4, $5, $6, $7, $8 "chl-a", $9, "ug/l" } Robert, That does make sense, but none of

Re: [PLUG] Gawk: skipping first line

2021-11-19 Thread Robert Citek
Close. Remember, an awk script has the structure … PATTERN { ACTION } So you want ‘NR > 1’ to be a pattern, but you have it as an action. Your code needs to look more like this … BEGIN { FS = ","; OFS = "," } NR > 1 { print $1, $2, $3, $4, $5, $6, $7, $8 "chl-a", $9, "ug/l" } Regards, - Robert

[PLUG] Gawk: skipping first line

2021-11-19 Thread Rich Shepard
I have data files needing more columns. The first row is the header with column names and I want to skip that row. I have not found the proper place to put the command to skip the first row. Here's an example: - #!/usr/bin/gawk { NR > 1 } BEGIN { FS = ","; OFS = "," } { print $1,