![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Is there a awk solution for this?? | timj123 | Shell Programming and Scripting | 7 | 03-14-2008 03:28 AM |
| Is There a Sed Solution for This? | racbern | Shell Programming and Scripting | 1 | 03-13-2008 08:31 AM |
| Grep solution | Amruta Pitkar | Shell Programming and Scripting | 3 | 05-02-2007 11:57 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
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
|
|||
|
|||
|
double quote
hi KKC,
please you double quote <"> instead of single quote <'> in your sed command, then it should be ok. |
|
#4
|
|||
|
|||
|
Quote:
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
|
|||
|
|||
|
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
|
|||
|
|||
|
Quote:
many thanks |
|
#7
|
|||
|
|||
|
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 |
|||
| Google The UNIX and Linux Forums |