The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to print data between 2 lines in a file kamesh83 UNIX for Advanced & Expert Users 5 12-18-2008 12:14 PM
print all even lines of a txt file ajp7701 Shell Programming and Scripting 1 04-18-2008 12:17 AM
How to print only lines in between two strings using awk jisha Shell Programming and Scripting 4 01-11-2008 04:13 AM
print selected lines tonet Shell Programming and Scripting 6 10-08-2007 06:50 AM
Print only certain lines from a text file CamTu Shell Programming and Scripting 1 06-01-2005 12:47 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-18-2008
Annihilannic Annihilannic is offline Forum Advisor  
  
 

Join Date: May 2008
Location: Sydney, Australia
Posts: 1,009
You're almost there... no need for the single quotes, and you can separate commands using ";", e.g.


Code:
sed "s/$esid/$sid/g;s/$emount/$mount/g;s/REUSE/SET/g;s/$ESID/$SID/g" temp>temp1

  #2 (permalink)  
Old 07-18-2008
jack00423 jack00423 is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 23
Thanks alot Annihilannic...
one more thing..

How to pass dynamic values to
sed "s/$esid/$sid/g;s/$emount/$mount/g;s/REUSE/SET/g;s/$ESID/$SID/g
to this $esid,sid ..
echo "enter esid"
read esid
echo "enter emount"
read emount
echo "enter ESID"
read ESID
echo "enter sid"
read sid
echo "enter mount"
read mount
echo "enter SID"
read SID
sed 's/$esid/$sid/g;s/$emount/$mount/g;s/REUSE/SET/g;s/$ESID/$SID/g' temp>temp1

Here the values are not taking ..Please help

Thanks
jack
  #3 (permalink)  
Old 07-18-2008
Annihilannic Annihilannic is offline Forum Advisor  
  
 

Join Date: May 2008
Location: Sydney, Australia
Posts: 1,009
It's because you changed the double quotes " to single quotes '.

Single quotes prevent variables from being evaluated.
  #4 (permalink)  
Old 07-18-2008
jack00423 jack00423 is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 23
So many thanks Anni..I have learnt somany things from u...
It worked for me..

Thanks
Jack

Last edited by jack00423; 08-02-2008 at 02:33 AM..
  #5 (permalink)  
Old 08-02-2008
jack00423 jack00423 is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 23
HI,

I need to add two file

example
++++++++++
cat dum
1
22
333
4444

another file
cat dummy
hhh
xnnnn
xmmmm

i need to have both in one file.

1
22
333
4444
hhh
xnnnn
xmmmm

Please help on this..
Thanks
Jack
  #6 (permalink)  
Old 08-02-2008
danmero danmero is online now Forum Advisor  
  
 

Join Date: Nov 2007
Location: 45.48-73.63
Posts: 1,441
You can use cat here to appaent dummy file to dum:

Code:
cat dummy  >> dum

  #7 (permalink)  
Old 08-03-2008
Annihilannic Annihilannic is offline Forum Advisor  
  
 

Join Date: May 2008
Location: Sydney, Australia
Posts: 1,009
Or, of course, cat dum dummy > newfile. This is what cat was designed for, concatenating files.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:13 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0