Yes the solution that you have mentioned for my specified problem is correct.
But if the position of sathya varies each time then how can we solve it???
Let me explain u the problem,\
So these are the contents of the file1, Now consider that initially sathya is in the last position,
But when u use the file the second time the postion might change and the new position of sathya
would be the second or third or fourth, So what i mean to say is irrespective of positions of the word sathya , i want to add the contents of file2 one after the other next to sathya.......
A demo piece would be like this...
[CODE ]sathya manju kashyap Narayanan Narayanan Sathya sathya Narayanan [/CODE]
SO the contents of file2 are
Now i want the output like this,
The number of "sathya" in file1 will be equal to the strings present in file2.
I hope u have understood my problem.
I am trying to do this for the past 15 days and i am unable achieve it,
It would be very helpful if u solve this problem.
cat file1
cat file2
If file2 fits into memory then you can read it into an array.
sathya
XYZ1
manju
kashyap
Narayanan
Narayanan
Sathya
XYZ2
sathya
XYZ3
Narayanan
OSX
I have been grinding my teeth on a portion of code. I am building a bash script that edits a html email template. In the template, I have place holders for SED (or whatever program is appropriate) to use as anchors for find and replace, with user defined corresponding html code. The HTML code... (3 Replies)
Dear Unix Forums,
I am hoping you can help me with a pattern matching problem.
What am I trying to do?
I want to replace multiple lines of a text file (that match a multi-line pattern) with a single line of text. These patterns can span several lines and do not always have the same number of... (10 Replies)
Sed replace using same pattern repeating multiple times in a line
I have text like below in a file:
I am trying to replace the above line to following
How can I acheive this?
I am able to do it if the occurrence is for 1 time:
But If I try like below
I am getting like this:
I have to... (4 Replies)
Hi All,
I have a input file as sample below
<this is not starting of file>
record
line1
line2
line3
end
line4
line5
record
line6
line7
line8
my requirement is this, i want to select a pattern between first record and end, whatever is written between first record and end.
and... (0 Replies)
I'm attempting to insert multiple lines before a line matching a given search pattern. These lines are generated in a separate function and can either be piped in as stdout or read from a temporary file.
I've been able to insert the lines from a file after the pattern using:
sed -i '/pattern/... (2 Replies)
Hello People,
Need some assistance/guidance.
OUTLINE:
Two files (File1 and File2)
File1 has some ids such as
009463_3922_1827
897654_8764_5432
File2 has things along the lines of:
Query= 009463_3922_1827 length=252
(252 letters)
More stufff here
... (5 Replies)
the file contains the follwoing lines
/*
* Copyright (C) 1995-1996 by XXX Corporation. This program
* contains proprietary and confidential information. All rights reserved
* except as may be permitted by prior written consent.
*
* $Id: xxx_err.h,v 1.10 2001/07/26 18:48:34 zzzz $
... (1 Reply)