Hi All,
Could you please help me, why sed is not able to take variable value when I try to replace using sed.
I want to replace 2nd column (time) and keeping intact others.
From
TO
Moderator's Comments:
Please use CODE tags correctly (i.e. not enclosing a (sub)total text) as required by forum rules!
Last edited by RudiC; 03-12-2018 at 05:35 PM..
Reason: Changed CODE tags.
Hi All,
Could you please help me, why sed is not able to take variable value when I try to replace using sed.
.
.
.
Wouldn't a better wording be "sed is not taking shell variable value when used in above setup"? sed by its design / implementation is not meant to take shell variables (there's more suitable tools like awk or perl), and even less so when used like posted in post#1:
- Single quotes prevent shell expansion.
- Single quotes within the parameters might confuse the tool AND users.
- the entire "{script-only-if-no-other-script}" (c.f. man sed on linux Ubuntu 17.10) should be quoted - just to be on the safe side.
Hi,
I am new to unix/linux scripting.
I have a text file, listlib.txt where the content:
lib1_23
lib34_a
ab_li_lab
I need to generate a file (.log) of each cell. I am planning to create a (.csh) script that will have for loop with variable taken from listlib.txt. As for now, i have no... (4 Replies)
version=git
release=r8
echo lp-testsuite-git-r8.x86_64.rpm |sed -e "s/-$version-$release.*//g"
I want to get
lp-testsuite
what's wrong with me ? (1 Reply)
Hi all,
Hereby wish to have your advise for below:
Main concept is
I intend to get current directory of my script file.
This script file will be copied to /etc/init.d.
A string in this copy will be replaced with current directory value.
Below is original script file:
... (6 Replies)
Hi
I am trying to remove some characters from my data file.
The data file has huge number of records say 90000 records.
I am using sed for this purpose.
eg :
cat FILENAME|sed 's/;//g' (to remove semi colon ';')
However as the data file is too huge , it is taking too much time to give... (3 Replies)
I'm trying to make a sed substitution where the substitution pattern is an environment variable to be expanded, but the variable contains a "slash".
sed -e 's/<HOME_DIRECTORY>/'$HOME'/'This gives me the following error:
sed: -e expression #1, char 21: unknown option to `s'Obviously this is... (2 Replies)
Hi All,
How can i take the following code having three seds into a variable :
echo "$DateFileFormat" | sed 's/\./\\\\./g' | sed 's/\$/+/g' | sed 's/\#/'$job_date'/g'
I want to get the result stored in a script variable
i tried
var2=`echo "$DateFileFormat" | sed 's/\./\\\\./g' |... (4 Replies)
I want to instert Category:XXXXX into the 2. line
something like this should work, but I have somewhere the wrong sytanx. something with the linebreak goes wrong:
sed "2i\\${n}Category:$cat\n"
Sample:
Titel Blahh Blahh abllk sdhsd sjdhf
Blahh Blah Blahh
Blahh
Should look like... (2 Replies)
i need to use a value in the Variable to print a particular line from a file using sed command.
i tried the below one but its is not working
sed -n ' "$var"p ' abc.txt
but its is not working please help me to sort out this. (3 Replies)
Hello,
i have another sed question.. I'm trying to do variable substition with sed and i'm running into a problem.
my var1 is a string constructed like this:
filename1 filerev1 filepath1
my var2 is another string constructed like this:
filename2 filerev2 filepath2
when i do... (2 Replies)
Hi,
I am trying to export some 50 tables and i want to write a loop and execute the script for every table. I did for one table and its running. Can any one help me for setting a loop and running the script for all the tables
thanks (6 Replies)