The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
Is there a awk solution for this?? timj123 Shell Programming and Scripting 7 03-14-2008 06:28 AM
Is There a Sed Solution for This? racbern Shell Programming and Scripting 1 03-13-2008 11:31 AM
Grep solution Amruta Pitkar Shell Programming and Scripting 3 05-03-2007 02:57 AM

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 01-30-2008
kkc kkc is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 12
need solution for scripting

hi all,

i would like to add on the print command to prompt user to enter a value and store inside the variable name as $inName
after that the value will replace the existing line for ${METRICA_DIR}/TechnologyPacks/Spool/2030324032
i'm new in scripting, could anyone give me some hint for sripting?

tmpfile=/tmp/tmpfile.$$

for file in loaderconfiguration*.xml
do
sed 's|${METRICA_DIR}/TechnologyPacks/Spool/2030324032|$inName|g' $file > $tmpfile
mv $tmpfile $file
done

thanks
  #2 (permalink)  
Old 01-31-2008
nivas
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
Shell Programming

Hi,

Iam new to Shell programming and i want to Display the same lines in a file which is appearing more than once.

Here is a file format,

WERTFRT|1234567890
ASDFFGU|1230986545
WERTFRT|1234567890
CVBNMKL|7685645385

Here 1st and 3rd lines are same and i need to select and write it in to seperate file.
please help me.

Thanks in advance.
  #3 (permalink)  
Old 01-31-2008
summer_cherry summer_cherry is offline Forum Advisor  
Registered User
  
 

Join Date: Jun 2007
Location: Beijing China
Posts: 1,079
double quote

hi KKC,

please you double quote <"> instead of single quote <'> in your sed command, then it should be ok.
  #4 (permalink)  
Old 01-31-2008
kkc kkc is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 12
Quote:
Originally Posted by summer_cherry View Post
hi KKC,

please you double quote <"> instead of single quote <'> in your sed command, then it should be ok.
sorry i can't get you mean,
i wanted add on such like

print "what is your directory : ";
then the answer is storing to &inName

and the sed will replace the &inName to ${METRICA_DIR}/TechnologyPacks/Spool/2030324032

sed 's|${METRICA_DIR}/TechnologyPacks/Spool/2030324032|$inName|g' $file

Thanks in advance
  #5 (permalink)  
Old 01-31-2008
Karthikeyan_113 Karthikeyan_113 is offline
Registered User
  
 

Join Date: Jan 2007
Location: Boston, USA
Posts: 16
Thumbs up Clarification....

Hi KKC,

summer_cherry was asking you to replace the single codes in the sed command with double codes.

Code:
sed "s|${METRICA_DIR}/TechnologyPacks/Spool/2030324032|$inName|g" $file
==========
Thanks,
Karthikeyan.
==========
  #6 (permalink)  
Old 01-31-2008
kkc kkc is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 12
Quote:
Originally Posted by Karthikeyan_113 View Post
Hi KKC,

summer_cherry was asking you to replace the single codes in the sed command with double codes.

Code:
sed "s|${METRICA_DIR}/TechnologyPacks/Spool/2030324032|$inName|g" $file
==========
Thanks,
Karthikeyan.
==========
hi

thanks for the advise~, what is the different withe replace the single codes in the sed command with double codes?

many thanks
  #7 (permalink)  
Old 01-31-2008
namishtiwari namishtiwari is offline Forum Advisor  
Registered User
  
 

Join Date: Aug 2007
Location: Bangalore
Posts: 377
You can do something like this--

echo "Enter the file/dir name"
read file

then do the replacements here-
sed "s|${METRICA_DIR}/TechnologyPacks/Spool/2030324032|$inName|g" $file

Thanks
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 08:55 AM.


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