Hello! I'd like some help with a sentance, this 'if' should take a string from the user, then search my list for that string, now only those lines that string is found should be worked on.
I'm new to this, but i'm guessing it's something like this..
Maybe there's something better than an if sentance for this?
The file is a list of countrys and citys, like this:
Let's call this file 'addresses' and, the options in the script could be country names, like Sweden or Norway, and if the user choses 'Norway' we would copy all 'addresses' with Norway, as Country
I hope you understand, and can find some time to help me! (and please, if you have a solution, try and explain it alittle, as I said, i'm new.. )
To tell the truth I cant link your bit of script with what you are asking...
Quote:
take a string from the user, then search my list for that string
I dont see that n your script...
Quote:
now only those lines that string is found should be worked on
So what are option1 ... then?
If you are searching in a file, then grep is what you should use to sart with, then once found think if awk should not be prefered depending on what actions should follow...
To tell the truth I cant link your bit of script with what you are asking...
I dont see that n your script...
So what are option1 ... then?
If you are searching in a file, then grep is what you should use to sart with, then once found think if awk should not be prefered depending on what actions should follow...
I'm thinking, If option 1 is Norway, then when the user enters norway, everything in the list, that has the value 'Norway' as Country, gets copied to the new file.
What I need is a way to compare the users option with the value of 'country'.
Like
edit! and, it should do this on every line on the list, so maybe I need a for loop?
Use getopts (the bultin one ; getopt is an external) to parse arguments.
Once got familiar, it is very powerfull and helps alot in error handling/fetching
Search this Forum about it, has quite a lot threads on this Topic.
I suggest you write a script that accepts an input, lets call it OPT1, then grep that value in your file, and displays what is found.
Once that is achieved, You explain from the result what more you want...
So far for this script you need a read and grep , perhaps should we have an if if grep returns nothing...
i am having some bash script which must use first sentence of the file. For example i have file which content is:
test 213
So I must use word test into my bash script, and put it into variable.
I am using a one variable named value
value=$(</home/rusher/test.txt)
so instead using test.txt... (1 Reply)
Hi
I have two text files. The first file is TEXTFILEONE.txt as given below:
<Text Text_ID="10155645315851111_10155645333076543" From="460350337461111" Created="2011-03-16T17:05:37+0000" use_count="123">This is the first text</Text>
<Text Text_ID="10155645315851111_10155645317023456"... (7 Replies)
Hi All,
Is there another way to achieve this?
how get short phrase in a sentence with character count of 100 to 155 words end with period but don't end something like 50,000. .
Here's my current script but the output is not good. This will use for my snippets or preview.
grep... (6 Replies)
I want get a number(ID) from a sentence which has been grepped from file using error number.
For Example:
#!/bin/ksh
echo "Enter RRS ID: "
read rrs
echo "Enter error number:"
read err
scp -pr ptc-avdbamdw102:/home/icsprd/M3logs/Accurate/logs/corp_post/$rrs.*.err.txt $HOME/daemon_mail/... (7 Replies)
I would like to check with grep in this configuration file:
{
"alt-speed-down": 200,
"alt-speed-enabled": true,
"alt-speed-time-begin": 1140,
"alt-speed-time-day": 127,
"...something..." : true,
...
}
"alt-speed-enabled" (the third line of the file) is setted to... (2 Replies)
I have to pass a sentence in a file, the specs are as:
cat run | sed 's/SRT/'$8'/g' | sed 's/plength/68/g' | sed 's/stcol/'$5'/g' | sed 's/encol/'$6'/g' | sed 's/brdtype/'$1'/g' | sed's/brdtxt/'$3'/g' | sed 's/demotxt/Total '$2'/g' | sed 's/bantxt/ban_'$7'/g' | sed 's/validcodes/'$4'/g' > runx
... (1 Reply)
Hi People,
I need some Help to write a unix script that asks for a sentence to be typed out then with the sentence. Counts the number of spaces within the sentence and then echo's out "The Number Of Spaces In The Sentence is 4" as a example
Thanks
Danielle (12 Replies)
In a directry there are 100 files are present....
How to append a statement like "Anup Das" in each of the file content, in the first line....
without opening the files.... (2 Replies)
Hi,
I have two strings like this in an array:
For example:
@a=("Brain aging is associated with a progressive imbalance between intracellular concentration of Reactive Oxygen Species","Brain aging is associated with a progressive imbalance between intracellular concentration of Reactive... (9 Replies)
Hi,
I want to be able to list all the names in a file which begin with a capital letter, but I don't want it to list words that begin a new sentence. Is there any way round this?
Thanks for your help. (1 Reply)