11-26-2009
Dear, momo.reina.
Thank you for your commitment and the response, however, I need to do a comparison to the $ 4 string file1 contains the beginning of the string $ 3 file2, then if true print $ 1, $ 2, $ 3 (file2) and $ 3 (file1).
The output should have the following format:
CRA-JJ-W980-01; 2009-11-24, 0/0/0; GigabitEthernet
CRA-JJ-W980-01; 2009-11-24, 1/0/0; GigabitEthernet
CRA-JJ-W980-01; 2009-11-24, 3/0/0; GigabitEthernet
CRA-JJ-W980-01; 2009-11-24, 5/0/1; GigabitEthernet
CRA-JJ-W980-01; 2009-11-24, 13/0/0; ATM
CRA-JJ-W980-01; 2009-11-24, 13/0/1; ATM
CRA-JJ-W980-01; 2009-11-24, 13/0/2; ATM
CRA-JJ-W980-01; 2009-11-24, 13/0/3; ATM
CRA-JJ-W980-01; 2009-11-24, 14/0/0; ATM
CRA-JJ-W980-01; 2009-11-24, 14/0/1; ATM
CRA-JJ-W980-01; 2009-11-24, 14/0/2; ATM
CRA-JJ-W980-01; 2009-11-24, 14/0/3; ATM
CRA-JJ-W980-01; 2009-11-24, 15/0/0; ATM
CRA-JJ-W980-01; 2009-11-24, 15/0/1; ATM
CRA-JJ-W980-01; 2009-11-24, 15/0/2; ATM
CRA-JJ-W980-01; 2009-11-24, 15/0/3; ATM
thanks
He2
---------- Post updated at 11:34 AM ---------- Previous update was at 11:28 AM ----------
Dear, durden_tyler
Thanks for the reply. Your script generated the output perfect, but in my shell (Solaris 7 with bash-2.05) can not work with vector.
Always gives error in the scripts array.
thanks
He2
8 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
How does one escape the left bracket in awk?
For example:
| awk 'gsub ("
I'm sure it's pretty simple, I'm just a noob. (1 Reply)
Discussion started by: TheCrunge
1 Replies
2. Shell Programming and Scripting
Ive got some output in a file that looks exactly like this:
1
-----------
1542
1 record(s) selected.
How do I just extract that 1542 and drop it into another file or (preferrably) a variable (using a ksh script) (9 Replies)
Discussion started by: rdudejr
9 Replies
3. UNIX for Dummies Questions & Answers
Hi again. Sorry if it seems like I'm spamming the boards a bit, but I figured I might as well ask all the questions I need answers to at once, and hopefully at least get some.
I have installed Solaris 10 on a server. The default text editors are there (vi, ex, ed, maybe others, I know emacs is... (4 Replies)
Discussion started by: EugeneG
4 Replies
4. UNIX for Dummies Questions & Answers
I have this output:
uniquemember=uid=315kthatch,ou=people,ou=client315,dc=paisleyhosting,dc=com
and i want the output to be just this:
315kthatch
I need it to be generic tho, because I have hundreds of lines of output, and the preceding numbers are not always 315. So I would need... (3 Replies)
Discussion started by: kthatch
3 Replies
5. UNIX for Dummies Questions & Answers
I have a file called mytitles.txt containing a list of book titles
I have a second file called abfile.txt containing a list of book titles (in the 3rd field) and it has author info and copyright year info as well..
I want to search mytitles.txt for a match in the 3rd field of abfiles.txt, and... (2 Replies)
Discussion started by: glev2005
2 Replies
6. Shell Programming and Scripting
Hi Guru's.
I am trying to use to check if $5 is greater than 80 & if not 100, then to print $0 :
awk '{ if ($5>80) && if ($5 != 100) print $0}
But getting error:
>bdf1|sed 's/%//g'|awk '{ if ($5>80) && if ($5 != 100) print $0}'
syntax error The source line is 1.
The error... (6 Replies)
Discussion started by: rveri
6 Replies
7. Shell Programming and Scripting
Hello Experts..
I have 3-4 C codes with Oracle SQL statements embedded. All the SQL statements starts with EXEC SQL keyword and ends with ;. I want to extract all the SQL statements out of these codes.
I did awk '/^EXEC SQL/,/\;/' inputFile (I use this on all of the codes individually). That... (2 Replies)
Discussion started by: juzz4fun
2 Replies
8. Shell Programming and Scripting
So, I have the following code:
cat testfile.txt | awk -F, '{ print $1" "$2" "$3" "$4" "$5 }' | read DOC ORG NAME
echo "$DOC"
echo "$ORG"
echo "$NAME"
My testfile.txt looks something like the following:
Document Type,Project Number,Org ID,Invoice Number
It will eventually be more... (14 Replies)
Discussion started by: Parrakarry
14 Replies
IGAWK(1) Utility Commands IGAWK(1)
NAME
igawk - gawk with include files
SYNOPSIS
igawk [ all gawk options ] -f program-file [ -- ] file ...
igawk [ all gawk options ] [ -- ] program-text file ...
DESCRIPTION
Igawk is a simple shell script that adds the ability to have ``include files'' to gawk(1).
AWK programs for igawk are the same as for gawk, except that, in addition, you may have lines like
@include getopt.awk
in your program to include the file getopt.awk from either the current directory or one of the other directories in the search path.
OPTIONS
See gawk(1) for a full description of the AWK language and the options that gawk supports.
EXAMPLES
cat << EOF > test.awk
@include getopt.awk
BEGIN {
while (getopt(ARGC, ARGV, "am:q") != -1)
...
}
EOF
igawk -f test.awk
SEE ALSO
gawk(1)
Effective AWK Programming, Edition 1.0, published by the Free Software Foundation, 1995.
AUTHOR
Arnold Robbins (arnold@skeeve.com).
Free Software Foundation Nov 3 1999 IGAWK(1)