10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
My code fails to do anything if I've BEGIN block in it:
Run the awk script as:
awk -f ~/bin/sum_dupli_gene.awk make_gene_probe.txt
#!/usr/bin/awk -f
BEGIN {
print ARGV
#--loads of stuff
}
END{
#more stuff
} (14 Replies)
Discussion started by: genome
14 Replies
2. UNIX for Dummies Questions & Answers
Hi,
I have written below script to begin if the line has n
#!/bin/ksh
/usr/xpg4/bin/awk {/ n / 'BEGIN {X = "01"; X = "02"; X = "03"; X = "04";
X = "05"; X = "06"; X = "07"; X = "08";
X ="09"; X = "10"; X = "11"; X = "12"; };}
NR > 1 {print $1 "\t" $5 "," X "," $6 " " $7}'} input.txt |... (9 Replies)
Discussion started by: stew
9 Replies
3. Shell Programming and Scripting
Newbie question, not sure of the use of BEGIN when you can just have the enclosed code inserted before the remaining program which means that code will get executed first anyway? (2 Replies)
Discussion started by: stevensw
2 Replies
4. Shell Programming and Scripting
awk
'BEGIN {
print "line one\nline two\nline three"
}'
After ./awktest.sh
Usage: awk -f progfile file ...
Usage: awk 'program' file ...
POSIX options: GNU long options:
-f progfile --file=progfile
-F fs --field-separator=fs
-v var=val ... (7 Replies)
Discussion started by: cola
7 Replies
5. Shell Programming and Scripting
Hi,
I have a file that has rows that start with # and ends with #. For example..
# hi text
JK NM
JK NM
JK K
JK NM
# no
# yes
So I want to remove the #'s and put them into another file. so the output will be two files..
File 1:
JK NM
JK NM
JK K
JK NM (3 Replies)
Discussion started by: phil_heath
3 Replies
6. Shell Programming and Scripting
I am beginner in awk
awk 'BEGIN{for(i=1;(getline<"opnoise")>0;i++) arr=$1}{print arr}'
In the above script, opnoise is a file, I am reading it into an array and then printing the value corresponding to index 20. Well this is not my real objective, but I have posted this example to describe... (1 Reply)
Discussion started by: akshaykr2
1 Replies
7. Shell Programming and Scripting
what does this clause means in UNIX
'BEGIN { FS="|";OFS="|" }
the complete clause is like
find . -name $filename | xargs awk -v s1=$String1 -v s2=$String2 -v s3=$String3 -v s4=$String4 'BEGIN { FS="|";OFS="|" }
Please advice. (2 Replies)
Discussion started by: jojo123
2 Replies
8. Shell Programming and Scripting
Hi all,
i am new to scripting. i need to write a code to detect begin and end of word that either begins or ends with t,th,d,dh,s,sh
i have a set of words in a file containg one word per line. let the filename be aaa.txt.
i have an another file bbb.txt which has two lines, just specifying the... (7 Replies)
Discussion started by: blkanth
7 Replies
9. UNIX for Dummies Questions & Answers
so im new :)
i whant to use and learn UNIX, but i dont know annythign about the system. so i need some help getting started :) (5 Replies)
Discussion started by: Morton
5 Replies
10. Shell Programming and Scripting
Why would you need to use this in a script?
Why can't you just use print to print out what you want printed in the begining and print for what you want at the end.
So this:
nawk 'BEGIN {print "this is the first line"}
{print $1 $2 $3}
{print $5 $6}
END {print "this is the last line"}'
... (2 Replies)
Discussion started by: llsmr777
2 Replies