06-14-2011
Script to search for a particular word in files and print the word and path name
Hi, i am new to unix shell scripting and i need a script which would search for a particular word in all the files present in a directory. The output should have the word and file path name. For example: "word" "path name".
Thanks for the reply in adv,
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hi ,
i m having a html file and this file looks like this
<ssl>
<name>PIA</name>
<enabled>true</enabled>
<listen-port>39370</listen-port>
</ssl>
<log>
<name>PIA</name>
</log>
<execute-queue>
<name>weblogic.kernel.Default</name>
... (7 Replies)
Discussion started by: becksram123
7 Replies
2. Shell Programming and Scripting
Hi,
Our input xml looks like:
<doc>
<str name="account_id">1111</str>
<str name="prd_id">DHEP155EK</str>
</doc>
- <doc>
<str name="account_id">6666</str>
<str name="prd_id">394531662</str>
</doc>
- <doc>
<str name="account_id">6666</str>
<str... (1 Reply)
Discussion started by: Jassz
1 Replies
3. Shell Programming and Scripting
Hi,
I have to search a word in a text file and then I have to delete lines above from the word searched . For eg suppose the file is like this:
Records
P1
10,23423432
,77:1
,234:2
P2
10,9089004
,77:1
,234:2
,87:123
,9898:2
P3
456456
P1
:123,456456546
P2
abc:324234 (2 Replies)
Discussion started by: vsachan
2 Replies
4. UNIX for Dummies Questions & Answers
I have a file that has the words I want to find in other files (but lets say I just want to find my words in a single file). Those words are IDs, so if my word is ZZZ4, outputs like aaZZZ4, ZZZ4bb, aaZZZ4bb, ZZ4, ZZZ, ZyZ4, ZZZ4.8 (or anything like that) WON'T BE USEFUL.
I need the whole word... (6 Replies)
Discussion started by: chicchan
6 Replies
5. Shell Programming and Scripting
hi all, I'm new there, I'm just playing with perl and lwp and I just successfully created a script for log in to a web site with post. I have a response but I would like to have something like this:
I have in my response lines like:
<div class="sender">mimi020</div>
<some html code.....>... (3 Replies)
Discussion started by: vogueestylee
3 Replies
6. Shell Programming and Scripting
I have a file input.txt which have loads of weird characters, html tags and useful materials. I want to display 35 characters after the word description excluding weird characters like $$#$#@$#@***$# and without html tags in the new file output.txt. Help me. Thanx in advance.
My final goal is to... (11 Replies)
Discussion started by: sachit adhikari
11 Replies
7. Shell Programming and Scripting
I have a file input.txt which have loads of weird characters, html tags and useful materials. I want to display 35 characters after the word "description" excluding weird characters like $&lmp and without html tags in the new file output.txt. Help me. Thanx in advance. I have attached the input... (4 Replies)
Discussion started by: sachit adhikari
4 Replies
8. Shell Programming and Scripting
Hi,
I am trying to search for a word and print the next word. For example:
My text is "<TRANSFORMATION TYPE ="Lookup Procedure">"
I am searching for "TYPE" and trying to print ="Lookup Procedure"
I have written a code like following:
echo $line | nawk... (4 Replies)
Discussion started by: sampoorna
4 Replies
9. Shell Programming and Scripting
Hi,
I have a sample file as shown below, I am looking for sed or any command which prints the complete word only from the input file.
Ex:
$ cat "sample.log"
I am searching for a word which is present in this file
We can do a pattern search using grep but I need to cut only the word which... (1 Reply)
Discussion started by: mohan_kumarcs
1 Replies
10. UNIX for Beginners Questions & Answers
I have a multicolumn text file with header in the first row like this
The headers are stored in an array called . which contains I want to search for each elements of this array from that multicolumn text file. And I am using this awk approach
for ii in ${hdr}
do
gawk -vcol="$ii" -F... (1 Reply)
Discussion started by: Atta
1 Replies
Commands Reference, Volume 1, a - c
apropos_Command
Purpose
Locates commands by keyword lookup.
Syntax
apropos [ -M PathName ] Keyword ...
Description
The apropos command shows the manual sections that contain any
of the
keywords specified by the Keyword parameter in their title.
The apropos
command considers each word separately and does not take into
account if a
letter is in uppercase or lowercase. Words that are part of
other words
are also displayed. For example, when looking for the word
compile, the
apropos command also finds all instances of the word compiler.
The
database containing the keywords is /usr/share/man/whatis,
which must
first be generated with the catman -w command.
If the output of the apropos command begins with a name and
section
number, you can enter man Section Title. For example, if the
output of the
apropos command is printf(3), you can enter man 3 printf to
obtain the
manual page on the printf subroutine.
The apropos command is equivalent to using the man command
with the -k
option.
Note: When the /usr/share/man/whatis database is built from
the HTML
library using the catman -w command, section 3 is equivalent
to section
2 or 3. See the man command for further explanation of sec-
tions.
Flag
Specifies an alternative search path. The search
path is
-M PathName specified by the PathName parameter, and is a
colon-separated
list of directories.
Examples
1. To find the manual sections that contain the word password
in their
titles, enter:
apropos password
2. To find the manual sections that contain the word editor
in their
titles, enter:
apropos editor
File
/usr/share/man/whatis Contains the whatis data-
base.
Related Information
The catman command, man command, whatis command.
________________________________________________________________________________
Commands Reference, Volume 1, a - c
apropos_Command
Purpose
Locates commands by keyword lookup.
Syntax
apropos [ -M PathName ] Keyword ...
Description
The apropos command shows the manual sections that contain any
of the
keywords specified by the Keyword parameter in their title.
The apropos
command considers each word separately and does not take into
account if a
letter is in uppercase or lowercase. Words that are part of
other words
are also displayed. For example, when looking for the word
compile, the
apropos command also finds all instances of the word compiler.
The
database containing the keywords is /usr/share/man/whatis,
which must
first be generated with the catman -w command.
If the output of the apropos command begins with a name and
section
number, you can enter man Section Title. For example, if the
output of the
apropos command is printf(3), you can enter man 3 printf to
obtain the
manual page on the printf subroutine.
The apropos command is equivalent to using the man command
with the -k
option.
Note: When the /usr/share/man/whatis database is built from
the HTML
library using the catman -w command, section 3 is equivalent
to section
2 or 3. See the man command for further explanation of sec-
tions.
Flag
Specifies an alternative search path. The search
path is
-M PathName specified by the PathName parameter, and is a
colon-separated
list of directories.
Examples
1. To find the manual sections that contain the word password
in their
titles, enter:
apropos password
2. To find the manual sections that contain the word editor
in their
titles, enter:
apropos editor
File
/usr/share/man/whatis Contains the whatis data-
base.
Related Information
The catman command, man command, whatis command.