First, you won't get variable substitution inside single-quotes:
Single-quotes lose their special quoting superpowers when inside double-quotes.
Also, if you pass a string to a command that includes a dash ("-") you run the risk of the string being interpreted as flags. You should therefore use the double-dash to indicate that no more flags are coming:
So if "$string" includes any dashes, they will be ignored since they are after the "--".
Sir,
I have a file containing say 1000 lines that contain 100 paragraphs of 10 lines each separated by blank lines.I have to match a pattern or a string "hdfhasdjkasdhs" and print the complete paragraphs containing these strings.I can do this with the help of line editor ex,but how can I use... (1 Reply)
:rolleyes: Hi,
How to take the time diffence between start and finish time from a log file?
It is like
..... started at Jun 20 23:20
.
.
..... finished at Jun 21 01:40
Tryed so many ways but failed to ger exact way. :confused:
Your help will be honoured.
Ta........Lokesha (1 Reply)
Im trying to replace every line
line1
line2
line3
with:
line1
extraline1
line2
extraline2
line3
extraline3
with about 10 extra lines
I am able to add axtra lines with: (17 Replies)
en...how to grep some words from some file,
the goal is that, we donot want the words are exactly 9 charactor,
and want to grep from some words that are longer than 9 and it contain a substring that with 9 different charactors (2 Replies)
I found a command who prints x lines before and after a line who contain a searched string in a text file.
The command is :
nawk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r;print;c=a}b{r=$0}' b=2 a=4 s="string" file1
It works very well but I can't understand the syntax, too difficult with... (2 Replies)
I don't know if this is a big issue or not, but I'm having difficulties. I apoligize for the upcoming essay :o.
I'm writing a script, similar to a paint program that edits images, but in the form of ANSI block characters. The program so far is working. I managed to save the image into a file,... (14 Replies)
Hello,
I need to make shell script menu for my end users. There is like 100 scripts in system, and they need to run that scripts true one main script with user friendly menu.
Example, when user will run main menu script, it will get something like this on his screen:... (3 Replies)
Hello,
I was reading Heuritics text and came across an algorithm below. Finding hard to analyze it can any one help me out below...
How to analyze if I take say no. of types are 5 and each type has say 20 coins.
thanks.
Let {c1, c2...cn=1} be a set of distinct coin types where ci is... (1 Reply)
Hello,
I need to make shell script menu for my end users. There is like 100 scripts in system, and they need to run that scripts true one main script with user friendly menu.
Example, when user will run main menu script, it will get something like this on his screen:... (1 Reply)
:wall::wall::wall:
Hi I have horrible script below, need help in renaming ls -l output into new filename format:
Desired output:
cp -pv original_path/.* newDirectory/owner_of_file.%dd%mm%y.file_extension.first_8_characters_of_original_filename
localuser@localuser:~ vi... (3 Replies)