08-17-2007
hey fazliturk,
thanx a lot...but if the field is going to change i.e. might be increased from 6 to 7 then , in real time it is not feasible to change the query to add one line $7 ~ srchname {print $7} !!!!!!
So i want irrespective of all the changes to i/p file, that we can think of, it should give us the o/p of the proper search value....but anyway thanx a lot.
lorcan, i tried your one it works fine , with some modification according to my requirement ....But still can we have some more modularized one...using AWK or SED.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
The following code seems to work, but why am i getting an error message?
cscyabl@comet:(develop)> awk 'BEGIN {FS="|"}{print $2 >> $1}' test.sum
awk: A print or getline function must have a file name.
The input line number is 8. The file is test.sum.
The source line number is 1.
... (2 Replies)
Discussion started by: Indalecio
2 Replies
2. Shell Programming and Scripting
Hello All,
I'm trying to write a script that will perform a dynamic match (of a dynamic variable) and set a variable to have the resulting (match) value.
The idea is that the environment variable to check ($1) and the regular expression to use ($2) are given as parameters.
For example,... (5 Replies)
Discussion started by: aedgar
5 Replies
3. Shell Programming and Scripting
Hello All,
I have a requirement to match a dynamic url and extract each of the directory and page and store it -Only PERL style Regular EXP as it will be used in informatica - REG_EXTRACT function
Example Input URLs:
1)... (2 Replies)
Discussion started by: jambesh
2 Replies
4. Shell Programming and Scripting
Hi,
I have a data in a file like below -
andy 22 abc 30000 wallstreet
paul 30 xyz 40000 martstreet
john 35 abc 50000 martstreet
I want to search number of employees working in a particular company. Below query executes perfectly -
awk '/abc/{ COUNT ++; }END { print "number of... (3 Replies)
Discussion started by: shell123
3 Replies
5. UNIX for Dummies Questions & Answers
Hello, can someone help me how to find a word and 2 lines after it and then send the output to another file.
For example, here is myfile1.txt. I want to search for "Error" and 2 lines below it and send it to myfile2.txt
I tried with grep -A but it's not supported on my system.
I tried with awk,... (4 Replies)
Discussion started by: eurouno
4 Replies
6. Shell Programming and Scripting
Hello All,
I have a requirement in which i will be given a sql query as input in a file with dynamic number of columns. For example some times i will get 5 columns, some times 8 columns etc up to 20 columns.
So my requirement is to generate a output query which will have 20 columns all the... (7 Replies)
Discussion started by: vikas_trl
7 Replies
7. Shell Programming and Scripting
I am trying to look for $2 of file1 (skipping the header) in $2 of file2 (skipping the header) and if they match and the value in $10 is > 30 and $11 is > 49, then print the line from file1 to a output file. If no match is foung the line is not printed. Both the input and output are tab-delimited.... (3 Replies)
Discussion started by: cmccabe
3 Replies
8. Shell Programming and Scripting
I am trying to create a cronjob that will run on startup that will look at a list.txt file to see if there is a later version of a database using database.txt as the source. The matching lines are written to output.
$1 in database.txt will be in list.txt as a partial match. $2 of database.txt... (2 Replies)
Discussion started by: cmccabe
2 Replies
9. Shell Programming and Scripting
In the awk below I am trying to output those lines that Match between file1 and file2, those Missing in file1, and those missing in file2. Using each $1,$2,$4,$5 value as a key to match on, that is if those 4 fields are found in both files the match, but if those 4 fields are not found then missing... (0 Replies)
Discussion started by: cmccabe
0 Replies
10. UNIX for Advanced & Expert Users
Hi All,
I got struck at the below point where i am unable to get the desired output after forming the dynamic conditions.Below is the design.
1. We are getting inputs from the shell arguments and storing in a variable like below.
CONDITIONS="1=CT,2=US_10,3=CT_US_10"
2. After this i am... (14 Replies)
Discussion started by: cskumar
14 Replies