![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need Replacement for sed | dbsurf | Shell Programming and Scripting | 0 | 01-25-2008 02:47 PM |
| Replacement of Delimiter | panknil | Shell Programming and Scripting | 3 | 05-14-2007 04:35 AM |
| Replacement using sed | handak9 | UNIX for Dummies Questions & Answers | 5 | 07-13-2004 08:28 AM |
| cpu replacement. help | IMPTRUE | UNIX for Dummies Questions & Answers | 3 | 07-25-2003 05:40 AM |
| global replacement | Babu | UNIX for Dummies Questions & Answers | 2 | 07-04-2001 06:02 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
I have two files:
file1: somedata <html> <head> This is sample statement ...... ...... </head> </html> somedata file2: olga 81 91 B A rene 82 92 B A zack 83 93 Expextd Result: somedata <html> <head> olga 81 91 B A rene 82 92 B A zack 83 93 </head> </html> Thx in advance, rajx |
| Forum Sponsor | ||
|
|
|
|||
|
This code will create new file,
Code:
#!/usr/bin/ksh
file1="FileName1"
file2="FileName2"
Result="ResultFile"
for str in `cat $file1`
do
if [ $str = "<head>" ]; then
echo $str >> $Result
echo `cat $file2` >> $Result
else
echo $str >> $Result
fi
done
|
|
|||
|
Thanks for your response,but i need following
I have two files:
FILE1: somedata <html> <head> This is sample statement ...... ...... </head> </html> somedata FILE2: olga 81 91 B A rene 82 92 B A zack 83 93 Expextd Result: FILE1: somedata <html> <head> olga 81 91 B A rene 82 92 B A zack 83 93 </head> </html> MY question is how to replace the file2 contents into file1 between the patteren <head> and</head> Thx in advance, rajx Last edited by rajx; 05-22-2007 at 06:48 AM. |
|||
| Google The UNIX and Linux Forums |