Trying to print every nth line of a huge file. Normally when using gsed one can use sed -n '3~7p' to print every 7th row starting from the 3th one.
Working on AIX teh syntax sed -n '3,${p;n;n;n;n;n;n;}' is needed. However the problem is my file is to big so the param $p;n...... is becoming to...
To explain my question I build a small testcase. I have a command that seems to run fine when executed on commandline in windows:
C:\Tools\gawk>echo Hello World|gawk "{ for (i = 1; i <= NF ; i++) printf \"%s\t\", substr($i,1,7); }"
Hello World
However when I do run it in a cmd file it goes...
My mistake. I didn't know the Solaris box had multiple versions of awk installed. Using nawk made my last question obsolete.
Thanks all for your quick support!!
Damn I was too excited yesterday when experimenting on my test system. It seems the prod system has the very basic awk and that one does not alow for "command" | getline syntax.
(seems only supported by NAWK and GAWK).
Guess that means: not possible in this version?
Thanks for your quick reply Feherke!
As far as I can see the difference between the two is that the original version updates the timestamp per record. The 2nd has a fixed timestamp...
I have this command running on Linux :
vmstat 30|awk '{now=strftime("%Y%m%d %T"); print now $0}'
But on Solaris I obviously don't have strftime. Any options or custom function to create same behaviour...
A certain progam provides a column based output but column order is different for systems/versions.
Simplefied something like this:
System A:
ColB ColA ColC ColD
1 4 1 1
2 2 5 4
1 3 0 1
System B:
ColD ColB ColA...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.