shell script positional parameters have to be inside double quotes and singe quotes when using the sed.
below is code:
I think you confused all of us with the references to vi when you are not using vi at all.
Your sed command is doing a lot of unnecessary switching between single quotes and double quotes. You can get exactly the same results as the sed command above just using:
With the values you're using in this example, no quotes are needed at all. But if $table_name or $schema_name could expand to strings containing whitespace characters or characters that could have special meaning to the shell if they aren't quoted, the double quotes protect you in that case. The key point is that the shell doesn't expand variables inside single quotes, so you have to use double quotes instead of single quotes if you want sed to see the table_name and schema_name variables expanded in your sed substitute command.
Hello all,
I have a weird issue when trying to substitute the slashes into backslashes.
If I execute this on the command-line (bash / ksh) I get the path correctly translated with backslashes instead of slashes.
> echo $PWD | sed 's/\//\\/g'
However, when I put this in my script to... (3 Replies)
Hi Friends,
Can any of you explain me about the below line of code?
mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`
Im not able to understand, what exactly it is doing :confused:
Any help would be useful for me.
Lokesha (4 Replies)
Hello experts,
I know line number of the word I want to replace. Can "sed" substitute word on a specific line?
As well, can sed substitute words inside a specific patten.
ex. <word>lalala</word> #replace anything between <word> and </word>
minifish (2 Replies)
Hey all,
I am trying to disable a certain cronjob before I run a backup. I want to be able to add/remove a "#" from the beginning on the crontab line it is located on.
Here is the crontab:
46 11 * * * /etc/webmin/cron/tempdelete.pl
@daily /etc/webmin/time/sync.pl
*/5 * * * *... (4 Replies)
Hi,
I have line in input file as below:
3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL
My expected output for line in the file must be :
"1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL"
Can someone... (7 Replies)
logs:
"/home/abc/public_html/index.php"
"/home/abc/public_html/index.php"
"/home/xyz/public_html/index.php"
"/home/xyz/public_html/index.php"
"/home/xyz/public_html/index.php"
how to use "cut" or "awk" or "sed" to get the following result:
abc
abc
xyz
xyz
xyz (8 Replies)
Hello.
System : opensuse leap 42.3
I have a bash script that build a text file.
I would like the last command doing :
print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt
where :
print_cmd ::= some printing... (1 Reply)