03-27-2014
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...
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
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)
Discussion started by: kev269
1 Replies
2. Shell Programming and Scripting
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)
Discussion started by: vanitham
9 Replies
3. Shell Programming and Scripting
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)
Discussion started by: anupdas
2 Replies
4. UNIX for Dummies Questions & Answers
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)
Discussion started by: charlie101208
12 Replies
5. Shell Programming and Scripting
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)
Discussion started by: patilrakesh1984
1 Replies
6. Shell Programming and Scripting
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)
Discussion started by: ciro314
2 Replies
7. Shell Programming and Scripting
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)
Discussion started by: JayDoshi
7 Replies
8. Shell Programming and Scripting
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)
Discussion started by: lxdorney
6 Replies
9. Shell Programming and Scripting
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)
Discussion started by: my_Perl
7 Replies
10. Shell Programming and Scripting
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)
Discussion started by: tomislav91
1 Replies
LOOK(1) BSD General Commands Manual LOOK(1)
NAME
look -- display lines beginning with a given string
SYNOPSIS
look [-bdf] [-t termchar] string [file ...]
DESCRIPTION
The look utility displays any lines in file which contain string as a prefix.
If file is not specified, the file /usr/share/dict/words is used, only alphanumeric characters are compared and the case of alphabetic char-
acters is ignored.
The following options are available:
-b, --binary
Use a binary search on the given word list. If you are ignoring case with -f or ignoring non-alphanumeric characters with -d, the
file must be sorted in the same way. Please note that these options are the default if no filename is given. See sort(1) for more
information on sorting files.
-d, --alphanum
Dictionary character set and order, i.e., only alphanumeric characters are compared.
-f, --ignore-case
Ignore the case of alphabetic characters.
-t, --terminate termchar
Specify a string termination character, i.e., only the characters in string up to and including the first occurrence of termchar are
compared.
ENVIRONMENT
The LANG, LC_ALL and LC_CTYPE environment variables affect the execution of the look utility. Their effect is described in environ(7).
FILES
/usr/share/dict/words the dictionary
EXIT STATUS
The look utility exits 0 if one or more lines were found and displayed, 1 if no lines were found, and >1 if an error occurred.
COMPATIBILITY
The original manual page stated that tabs and blank characters participated in comparisons when the -d option was specified. This was incor-
rect and the current man page matches the historic implementation.
look uses a linear search by default instead of a binary search, which is what most other implementations use by default.
The -a and --alternative flags are ignored for compatibility.
SEE ALSO
grep(1), sort(1)
HISTORY
A look utility appeared in Version 7 AT&T UNIX.
BUGS
Lines are not compared according to the current locale's collating order. Input files must be sorted with LC_COLLATE set to 'C'.
BSD
July 17, 2004 BSD