Sponsored Content
Top Forums UNIX for Dummies Questions & Answers doing a sed on certain variables Post 72320 by RishiPahuja on Friday 20th of May 2005 07:33:27 AM
Old 05-20-2005
Tools

Quote:
Originally Posted by seaten
Thanks RishiPahuja,

That make things clear. You might have noticed a new topic I have posted which describes a different solution to this problem.

The reason why is that ID-INTERNAL, will be replaced with 1 but also the comma will be removed and that is wrong. It doesn' necessarily have to be a comma it can be a brackes or plus sign,...


examples:
ID-INTERNAL,
ID-INTERNAL)
ID-INTERNAL+

Any ideas ?

Yes Mr. Seaten.... thts what exactly "-e 's/ID-INTERNAL[^-]/1/g'" is for

this will replace all ID-Internal except if next followin character is other then '-'
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

doing a sed with variables

Hi, I'm trying to do the following , I have certain variables in a file and then I want to check for these variables in a certain cobol file to see if they contain a certain package if so replace them with value 1 but but that last line is giving problems: # for each variable in SQL file ... (1 Reply)
Discussion started by: seaten
1 Replies

2. Shell Programming and Scripting

doing a sed with variables

Hi, I'm trying to do the following , I have certain variables in a file and then I want to check for these variables in a certain cobol file to see if they contain a certain package if so replace them with value 1 but but that last line is giving problems: # for each variable in SQL file ... (1 Reply)
Discussion started by: seaten
1 Replies

3. Shell Programming and Scripting

variables in sed

when i do something like substituting a particular thing with a system variable, i am unable to do that expect the varible name getting into that. for ex.. i tried, sed -e 's/date/`date`/g' <if >of but i got date replaced with "`date`" and not with the actual date .. same case happened... (5 Replies)
Discussion started by: sskb
5 Replies

4. Shell Programming and Scripting

Using sed with variables (again!)

Hi, I'm trying to use sed to delete the last three lines of a file. I currently have: # get the amount of lines in the file foldernum=`wc -l File_In.txt | cut -c1-8` # remove the lines in the file sed "${foldernum}-3,${foldernum}d" File_In.txt > File_Out.txt I get the error - sed:... (5 Replies)
Discussion started by: Mr_Plow
5 Replies

5. Shell Programming and Scripting

Sed variables

HELP!!! I'm keep getting "sed: Function s/PETS/dog cannot be parsed." I have 2 files that list... # cat FILE1.txt dog cat mouse # cat FILE2.txt my pets are PETS I put this into a variable... # A=`cat FILE1.txt` # sed "s/PETS/$A" FILE2.txt > FILE3.txt (5 Replies)
Discussion started by: Zenwork
5 Replies

6. Shell Programming and Scripting

using variables with sed

I'm trying to get sed to cut and replace using variables, but it doesnt seem to work, when I run this the mod time of the file does get updated. Is my syntax incorrect in the sed command? Thanks #!/usr/bin/ksh #Modify header set -x HEAD=$(cat PBN2CPR1.TXT | awk 'BEGIN { FS = ","... (1 Reply)
Discussion started by: ddurden7
1 Replies

7. UNIX for Dummies Questions & Answers

sed using variables

Hi, I am able to use sed if I hardcode the find and replace values in a shell script. This works: sed -e 's/123v/4567/g' /path/aaa.txt > /path/aaa.txt.tmp If I use a variable, I am not able to use sed command. why? This doesnot work: i=abc j=bk${i} sed -e 's/${i}/${j}/g'... (5 Replies)
Discussion started by: new_learner
5 Replies

8. Shell Programming and Scripting

variables and sed

Is it possible to place a variable in a sed command as such? sed 's/ret_Priv()/$var/' <filename> I am doing this under Bourne. (5 Replies)
Discussion started by: plslakewood
5 Replies

9. Shell Programming and Scripting

Using Variables with SED

All I am trying to produce the following in /etc/ssh/sshd_config, # IPv4 only #ListenAddress 0.0.0.0 # IPv4 & IPv6 ListenAddress :: to # IPv4 only ListenAddress <user-entry> ListenAddress <user-entry> # IPv4 & IPv6 #ListenAddress :: The number of user entries can vary. ... (1 Reply)
Discussion started by: miyoung999
1 Replies

10. Shell Programming and Scripting

sed with variables

Im trying to use sed to print value that matches the value in variable and all lines after that. grep "Something" test.txt | sed -e '/{$variable}/,$b' -e 'd' I cant get it work, if I replace the $variable with the value it contains, it works fine... (10 Replies)
Discussion started by: olkkis
10 Replies
ExtUtils::MM_Any(3pm)					 Perl Programmers Reference Guide				     ExtUtils::MM_Any(3pm)

NAME
ExtUtils::MM_Any - Platform agnostic MM methods SYNOPSIS
FOR INTERNAL USE ONLY! package ExtUtils::MM_SomeOS; # Temporarily, you have to subclass both. Put MM_Any first. require ExtUtils::MM_Any; require ExtUtils::MM_Unix; @ISA = qw(ExtUtils::MM_Any ExtUtils::Unix); DESCRIPTION
FOR INTERNAL USE ONLY! ExtUtils::MM_Any is a superclass for the ExtUtils::MM_* set of modules. It contains methods which are either inherently cross-platform or are written in a cross-platform manner. Subclass off of ExtUtils::MM_Any and ExtUtils::MM_Unix. This is a temporary solution. THIS MAY BE TEMPORARY! Inherently Cross-Platform Methods These are methods which are by their nature cross-platform and should always be cross-platform. File::Spec wrappers DEPRECATED The following methods are deprecated wrappers around File::Spec functions. They exist from before File::Spec did and in fact are from which File::Spec sprang. They are all deprecated. Please use File::Spec directly. canonpath catdir catfile curdir file_name_is_absolute path rootdir updir Thought To Be Cross-Platform Methods These are methods which are thought to be cross-platform by virtue of having been written in a way to avoid incompatibilities. test_via_harness my $command = $mm->test_via_harness($perl, $tests); Returns a $command line which runs the given set of $tests with Test::Harness and the given $perl. Used on the t/*.t files. test_via_script my $command = $mm->test_via_script($perl, $script); Returns a $command line which just runs a single test without Test::Harness. No checks are done on the results, they're just printed. Used for test.pl, since they don't always follow Test::Harness formatting. AUTHOR
Michael G Schwern <schwern@pobox.com> with code from ExtUtils::MM_Unix and ExtUtils::MM_Win32. perl v5.8.0 2002-06-01 ExtUtils::MM_Any(3pm)
All times are GMT -4. The time now is 09:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy