awk Programming Software Development by pooh1234qwerty $ awk -F ":" 'NR!=1 {print $1}' test1.txt what does this mean?? especially ":"?? awk script Programming Software Development by migg_21 awk '{print NR SEP $0}' SEP="/ " exfile1.txt > try2.txt here is a awk scritp which copies the contents form one to anthor it works well, but how do I change it to copy the contents in to several files ? can any one help please Re: awk Programming Software Development by Watael hi, `man awk` is very explicit about what is `-F` about what is `NR`, too. Re: awk "for loop" and variables Programming Software Development by swellcontour awk runs it's script once per line of input in the file. it automatically advances to the next record and feeds the input to your script. $1 is the first field of a record, and you print it once per record Awk help Programming Software Development by lockdon I want to use awk to strip certain fields from the output of the Dell… I want to run the command, pipe the output through awk and get the following: ID : 0:0:11 Status : Ok…Critical or Failed. My experience with awk is limited, and I am reading up on awk programming, but I would appreciate any… Re: Awk help Programming Software Development by Watael hi, awk -F' : ' 'BEGIN{b[1]="ID"; b[2]="Status"; b[3]="Name"; b[4]="State"; b[5]="Capacity"} {a[$1]=$0}END{ if(a["Status"] ~ "(Non-critical|Failed)$")for(i in b)print a[b[i]]}' awk help Programming Software Development by dyoung02 Hi All, I am trying to use awk to strip out the java version after I run the …. Does anyone know how I can pipe this output to awk and have it return just that value? Thx! DY Re: awk help Programming Software Development by dyoung02 I figured it out. If anyone is interested here is what I did: /h/jre/bin/java -version 2> javaver.txt JAVA=`more javaver.txt | awk '{print $3}'` JAVA_VERSION=`echo $JAVA | awk '{print $1}'` DY Re: awk script Programming Software Development by ghostdog74 …="/ " exfile1.txt > try2.txt here is a awk scritp which copies the contents form one to anthor it… ? can any one help please[/QUOTE] you can invoke the awk script again, or just use cp, like: cp try2.txt… Re: awk script Programming Software Development by ghostdog74 … 4 #say we rename your files with increasing numbers. do awk 'BEGIN{SEP="/ "} {print NR SEP $0}' file >….txt file3.txt file2.txt file1.txt [/code] all in awk: [code] awk 'BEGIN{ SEP="/ "; counter=1 while (counter<… Re: awk script Programming Software Development by masijade Uhhm, awk is a really large subject. O'Reilly publishing [url]http://www.oreilly.com/[/url] produces an entire book (and a good one at that) dedicated to sed and awk. Try that. Re: awk script Programming Software Development by migg_21 … another file(try1.txt)[/COLOR] [COLOR=#000000] [/COLOR] [COLOR=#000000]awk '{print NR SEP $0}' SEP="/ " exfile1.txt >…; try2.txt[/COLOR] [COLOR=#000000] [/COLOR] here is the awk script ,it doe's three things 1 it numbers the… Re: awk script Programming Software Development by migg_21 … try2.txt and try3.txt and so on [COLOR=#000000]awk '{print NR SEP $0}' SEP="/ " exfile1.txt >… Re: awk script Programming Software Development by ghostdog74 yes, you can put those into a script. use loops to create a counter for your files. eg psedocode count=1 awk '{print NR SEP $0}' SEP="/ " exfile1.txt for counter in the range 1 to the number of files: cp exfile1.txt try$counter.txt something like that. Re: awk script Programming Software Development by vssp Can you expline more awk script? AWK Extracting Multiple Lines Programming Software Development by WolfPack … are different from each other, I can use awk to extract the values of value1, value2 as follows…. [code] value1=$(awk '/option1/ {print $3}' $optfile) value2=$(awk '/option2/ {print $3}' $optfile) …multiple values for page_size, the following statement of awk [code] pagesize1=$(awk '/ page_size=/ {print $2}' $optfile)[/… Re: awk column to row format Programming Software Development by thekashyap … get what you want. In other words, `awk` expects your input to be a lot less complicated…inside 'in.txt' and run the following awk script: bash$ cat parse.awk # All lines like "key: value…key] } bash$ I get this output: bash$ awk -f parse.awk in.txt found ########## " 20121002T16"," Database… Re: AWK Extracting Multiple Lines Programming Software Development by jim mcnamara … use arrays: [code] #!/bin/ksh optfile=filename set -A opts \ $(awk 'BEGIN {FS="="} { if($0~ / page_size/) { prinf("%s…" opts as an array.[/QUOTE] I changed it so awk puts it all on the same line. Awk question Programming Software Development by mooglor …$(ls -l /home/stuff/tp |grep ^d|awk '{print $9}'); do find /home/stuff/tp/$…FolderToSearch/in -name '*.*'|awk '{print "zip -m " $ARCHIVE_PATH "… variables within the print statement of an awk statement. The above code is meant to…this is on AIX, where find and awk, although very similar, are a little bit… Re: Awk question Programming Software Development by eggi … your statement to expand variables from the shell within awk, like: [CODE]awk "{print "zip -m " $ARCHIVE_PATH $…If you want to specifically set a variable within the awk statement, you can set it like [CODE]var=value… you want to combine the two, since $1 in awk is distinctly different from $1 in the shell, depending.… Re: Awk question Programming Software Development by ghostdog74 use the -v option of awk to pass in shell variables so that you don't …have to get too confused between shell and awk variables. eg [code] awk -v archive="$ARCHIVE" ' { print archive # etc…] also you do not need to use ls , grep and awk just to get directory names. you can use find. [code… Re: AWK Extracting Multiple Lines Programming Software Development by jim mcnamara I'd use arrays: [code] #!/bin/ksh optfile=filename set -A opts $(awk 'BEGIN {FS="="} { if($0~ / page_size/) { print $2}}' $optfile) for i in 0 1 2 do echo ${opts[i]} done [/code] If you're using bash just "declare" opts as an array. Re: AWK Extracting Multiple Lines Programming Software Development by WolfPack … I could do this without using arrays. :eek: [code] page_size=$(awk 'BEGIN {FS="="} { if($0~ /paper_size/) { print $2}}' $optfile… Re: AWK Extracting Multiple Lines Programming Software Development by sut By the way, I wouldn't bother with awk. [code]#!/bin/ksh set -A opts $(sed -n 's/^ *paper_size *= *\(.*\)$/\1/p' optsfile) for opt in ${opts [*]} ; do echo $opt done[/code] Notice: I like to be able to use white space to keep it readable. The '*' matches zero or more occurances. awk in tcl Programming Software Development by amrita111 Hello..I am learning awk and tcl languages..I want to ask how can we integrate awk code in tcl file??? can we do this or we have to open call awk file from tcl???Reply soon. awk sort data bourne shell Programming Software Development by mossman mudas i have an awk script and in the end section i create my table … used pipe then sort i am calling it like this awk -f awkscript file in bash i can get it to… is not sure how to insert that back into my awk script as i get confused with all the ""… Re: Awk question Programming Software Development by mooglor … a little: My problem is specifically with this line: [code]awk '{print "zip -m " $ARCHIVE_PATH $FolderToSearch "zip2arc.zip… Re: Awk question Programming Software Development by chrisgood60 The problem is that those variables are within single quotes so are not expanded. You need to end the single quote before the variable and start it again after the variable when building your awk script eg echo 'This is singlequoted - TERM='$TERM' this is also single quoted' Re: awk print total Programming Software Development by eggi … you're trying to add 2. Since you're invoking awk twice, you need to include your BEGIN def's twice… last line of your function to: [CODE]sed 's/\$//' $dataFile|awk 'BEGIN{FS=","; RS="\n"} {total += $4… could save yourself some headach by just combining the two awk statements. Best wishes, Mike awk "for loop" and variables Programming Software Development by rhnaeco … the rest of the shell script This is my awk script so far : awk '{ for (i = 1; i <= 1; i++) print…