10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello All ,
I have to split a file as well as keep the header in all the splitted files.
For this I am using the getline function of awk to keep the header however the catch is header is of 4 lines and I have to hold all the 4 lines by getline function(or is there any other option ???) into a... (5 Replies)
Discussion started by: Pratik4891
5 Replies
2. Shell Programming and Scripting
Hi.. i am running nawk scripts on solaris system to get records of file1 not in file2 and find duplicate records in a while with the following scripts -compare
nawk 'NR==FNR{a++;next;} !a {print"line"FNR $0}' file1 file2duplicate - nawk '{a++}END{for(i in a){if(a-1)print i,a}}' file1in the middle... (12 Replies)
Discussion started by: Abhiraj Singh
12 Replies
3. Shell Programming and Scripting
I'm running the script below and get the output below against a file with
lineA=aaa
lineB=bbb
lineC=ccc
lineD=ddd
I get output:
lineC=ccc
lineD=ddd
I need the output to be:
lineB=bbb
lineC=ccc
lineD=ddd
cat filename | nawk '/lineA=aaa/ {
getline;
do {
getline (3 Replies)
Discussion started by: toor13
3 Replies
4. Shell Programming and Scripting
I am scanning a file (line by line) for format errors. A line could have multiple errors. Each field in the line is evaluated for errors and sent, along w/ any error messages, to a temporary file. Finally, if any errors were detected, this temporary file is then appended to the errorFile. The... (4 Replies)
Discussion started by: aschera
4 Replies
5. Programming
I can not get 'getline()' to compile. I have tried.
string curLine; //= compiler error
char* curLine; //=compiler error
char curLine; //=compiler error
Every example I see uses a string as a getline(); parameter. It does not work for me on Fedora14 with gcc-c++. Thank you so much. This... (1 Reply)
Discussion started by: sepoto
1 Replies
6. Shell Programming and Scripting
hi people;
this is my two awk code:
nawk '/cell+-/{r=(NF==8) ? $4FS$5FS$6 : NF==7 ? $4FS$5 : $4 ;c=split(r,rr);for (i=1;i<=c;i++){if(rr != "111111"){printf($3" %d ""\n",(i+3))}}printf("")}' /home/gc_sw/str.txt > /home/gc_sw/predwn.txt
nawk -F'*' '{gsub(/ *$/,"")}$0=$1$($NF-2)'... (2 Replies)
Discussion started by: gc_sw
2 Replies
7. Shell Programming and Scripting
i'm trying to use the "before" output from the match() function as part of the results of each Regex match... but...
My input data: (from an input file)
i only show the first record in my file.. all other records are similar.
mds_ar/bin/uedw92wp.ksh:cat $AI_SQL/wkly_inqry.sql... (2 Replies)
Discussion started by: danmauer
2 Replies
8. Shell Programming and Scripting
i'm new to shell scripting and have a problem please help me
in the script i have a nawk block which has a variable count
nawk{
.
.
.
count=count+1
print count
}
now i want to access the value of the count variable outside the awk block,like..
s=`expr count / m`
(m is... (5 Replies)
Discussion started by: saniya
5 Replies
9. Shell Programming and Scripting
Hi All,
I am using solaris and nawk.
Is there any time function in nawk which is simliar to the shell `date` function ?
Can any experts show any examples? (4 Replies)
Discussion started by: Raynon
4 Replies
10. Shell Programming and Scripting
HELP!!!! I am in an on-line shell programming class and have a question. Here is the data:
Mike Harrington:(510) 548-1278:250:100:175
Christian Dobbins:(408) 538-2358:155:90:201
Susan Dalsass:(206) 654-6279:250:60:50
(There are 12 contribuors total)
This database contains names, phone... (1 Reply)
Discussion started by: NewbieGirl
1 Replies