Search Results

Search: Posts Made By: MadeInGermany
6,057
Posted By MadeInGermany
sed -n "s/$key/$value/gp" $inputonly prints lines...
sed -n "s/$key/$value/gp" $inputonly prints lines where a substitution occurred.

But it won't print any existing lines that have not be substituted.
The following bash-4 script is a universal...
6,057
Posted By MadeInGermany
Yes that is the correct format. And it should...
Yes that is the correct format.
And it should be sed "s/$key/$value/g" with normal (double-)quotes, so the shell can expand $key and $value.

A more efficient way is to let the read command spllit...
6,057
Posted By MadeInGermany
Furthermore, sed gets the $line as a filename. ...
Furthermore, sed gets the $line as a filename.
If it should get it as input then do
echo "$line" | sed ...
Some shells (bash, zsh) take as well
sed ... <<< "$line"
6,057
Posted By MadeInGermany
The s command in sed takes one $key value and one...
The s command in sed takes one $key value and one $value value.
Apparently you need a loop that in each cycle gives one $key/$value pair.
6,057
Posted By MadeInGermany
Simply use two s commands: sed 's/.*\$\$//;...
Simply use two s commands:
sed 's/.*\$\$//; s/\..*//' test.txtIn the case there is no $$ it will still remove everything after a dot.
The following would avoid that:
sed '/.*\$\$/ { s///;...
Showing results 1 to 5 of 5

 
All times are GMT -4. The time now is 05:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy