05-24-2009
Problem with a awk script
awk '
/PIN1/{f=1}
f && /}/{print;system("cat *insert_file*");f=0;next}
1' file1 > newfile
I could not understand how this code works
Can anyone explains me this ?
Thanks and Regards
Kshitij Kulshreshtha
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I wrote a awk but doesnt work as expected.
The Input File
attached input file
My awk Script
/^.......*EXEC CICS /,/END-EXEC/
{
if ( $0 ~ / LINK / )
{ tsflag=1 }
if ( $0 ~ /EXEC CICS/ && tsflag == 1 )
... (6 Replies)
Discussion started by: pbsrinivas
6 Replies
2. Shell Programming and Scripting
Hi ,
I am having a file having the contents like this
file1
#####################
kite kshitij jolly admire in the wing
and tell me the secret behind
opus 123 and the right of the track
#########################
I have to write one awk script to substitue some values with other... (6 Replies)
Discussion started by: kshitij
6 Replies
3. Shell Programming and Scripting
Hi
Can anyone help me in this Problem
File1
#########################
HOLI 123 AND ONE TWO THREE AMITABH SAMSUNG
POLI AND TWO SENSE CRYING WING
PPIN TBFLAG I B AND OROLE TB_HOT=" DCT" TB_CAT=" CAT" TC_NOT=" AND"
+PIN TB=" HOT" TB_GATE=" KOT" TB_LATE=" MAT" TC=LOT
MAT DAT SAT... (5 Replies)
Discussion started by: kshitij
5 Replies
4. Shell Programming and Scripting
Hi All,
I have the following input data:
That I'd like to look like this ($2 is the column I'd like it to appear in) where the entries are grouped by date:
The code I have at present is:
awk 'BEGIN {}
{
dt = $1
if (dt == dt_prev) {
pp = $3
... (7 Replies)
Discussion started by: pondlife
7 Replies
5. Shell Programming and Scripting
hello,
first, yes i searched the forum , google and read many tutorials but still have a problem with my script.
I have great Problems, because i haven't worked with regular expressions before and never had anything to do with shellscripts. i am a complete Newby in this sort of theme.
I have... (8 Replies)
Discussion started by: Crashvogel
8 Replies
6. Shell Programming and Scripting
Hi,
I have one csv file with 3 fileds like
tmp1.csv
2079|2010Aug|cardilogy
2349|2010Aug|numerology
2213|2010Aug|immunlogy
another csv file with code for those specialities
spec.csv
cardiology|CRD
numerology|NMY
immunology|IMY
i want to replace the contents of file 1 with codes... (2 Replies)
Discussion started by: Man83Nagesh
2 Replies
7. Shell Programming and Scripting
Hi ,
I am having two files FILE1 and FILE2 as shown below
I need to search each and every element of Coulumn1 in the FILE1 in FILE2 and Globally replace with the Corresponding element of the Column2 in the FILE2 , For example and1 which is the first element of COl 1 of the FILE1 should be... (4 Replies)
Discussion started by: jaita
4 Replies
8. Shell Programming and Scripting
Hi,
I have two files
Hi,
I have two files
file1 :>
Code:
val="10" port="localhost:8080"httpadd="http:\\192.168.0.239"
file2 :>
Code:
val=${val} val="pdssx" port=${port}port="1324"httpadd=${httpadd}httpadd="raamraav"fileloc=${fileloc}
file3(or file2) should have following... (1 Reply)
Discussion started by: nitin.pathak
1 Replies
9. Shell Programming and Scripting
Can someone please explain to me what is wrong with this awk script?
echo 74 85 | awk '{
if ( $1 > $2 ) PRESULTS = ( $1 - $2 );
print $0,"=>","P"PRESULTS ;
else if ( $1 > $2 ) NRESULTS = ( $2 - $1... (3 Replies)
Discussion started by: SkySmart
3 Replies
10. Shell Programming and Scripting
Hello guys i have following problem. I'm trying to copy content of one file and paste this content in all .txt files in directory, but at line 15. My script copy the content at first line, not 15. I'm confused how to do this. Thank you in advance for your help!
This is my script:
ARGS=2 ... (9 Replies)
Discussion started by: r00ty
9 Replies
JOIN(1) General Commands Manual JOIN(1)
NAME
join - relational database operator
SYNOPSIS
join [ options ] file1 file2
DESCRIPTION
Join forms, on the standard output, a join of the two relations specified by the lines of file1 and file2. If file1 is `-', the standard
input is used.
File1 and file2 must be sorted in increasing ASCII collating sequence on the fields on which they are to be joined, normally the first in
each line.
There is one line in the output for each pair of lines in file1 and file2 that have identical join fields. The output line normally con-
sists of the common field, then the rest of the line from file1, then the rest of the line from file2.
Fields are normally separated by blank, tab or newline. In this case, multiple separators count as one, and leading separators are dis-
carded.
These options are recognized:
-an In addition to the normal output, produce a line for each unpairable line in file n, where n is 1 or 2.
-e s Replace empty output fields by string s.
-jn m Join on the mth field of file n. If n is missing, use the mth field in each file.
-o list
Each output line comprises the fields specifed in list, each element of which has the form n.m, where n is a file number and m is a
field number.
-tc Use character c as a separator (tab character). Every appearance of c in a line is significant.
SEE ALSO
sort(1), comm(1), awk(1)
BUGS
With default field separation, the collating sequence is that of sort -b; with -t, the sequence is that of a plain sort.
The conventions of join, sort, comm, uniq, look and awk(1) are wildly incongruous.
JOIN(1)