11-08-2007
Search and Parse string from inside a File
Hello,
I barely know the basics, but I am very determined to learn. I want to parse a few characters from each row, use that string to search another file and display the line number where I found the value in the file. I don't know if this can all be done on the command line, so I am creating a shell script that does this so far:
DIR = /cygdrive/c/temp/9*.txt
for item in parseFile.txt
do
foundValue = $item //do not know what command to use to search for a
//value and to parse from the file.
egrep -l "$item" $DIR //how do I display the line number where I found
//the item
done
Thanks for your help!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
I have a file that I need to be able to find a pattern match on one line then parse data on the next or subsequent lines - I will know which line needs to be parsed beforehand.
This is what I currently have:
while (<COMMAND_OUT>) {
if ($_ =~ m/TEST/) {
... (4 Replies)
Discussion started by: pondlife
4 Replies
2. Shell Programming and Scripting
How to search a pattern inside a zipped file ie (.gz file) with out unzipping it?
using grep command..
Bit urgent.. pls..help me (2 Replies)
Discussion started by: senraj01
2 Replies
3. Shell Programming and Scripting
Hello All,
I am new to this and I need to parse an XML file.
Here's the XML Input File:
<Report version="1.2">
<summary fatals="0" testcases="1" expected_fails="0" unexpected_passes="0" warnings="9" tests="21" errors="0" fails="1" passes="20" />
<testresult... (4 Replies)
Discussion started by: racbern
4 Replies
4. Shell Programming and Scripting
Hey Guys,
I need to search inside all the jar files of my directory for a specific string. Can anyone guide me as to how i can do it. I need this urgently please. More specifically i need to search for a class file name in the jar files.
Thanks in advance :-) (4 Replies)
Discussion started by: srikumar_cs
4 Replies
5. Shell Programming and Scripting
Hi
I need to parse the file of same name which exist on different servers and calculate the count of string existed in both files.
Say a file abc.log exist on 2 servers.
I want to search for string "test" on both files and calculate the total count of search string's existence.
For... (6 Replies)
Discussion started by: poweroflinux
6 Replies
6. Shell Programming and Scripting
Input file
0792 to 2450 iadmssql7:
Copy:
CNJ R1:
Replication volumes:
Replication set: RSet 1
Replication size: 200.00GB
SAN Info:
200.00GB DGC VRAID CX4-960 LUN 17 (17)
RPA Port WWN Ctrl ... (0 Replies)
Discussion started by: greycells
0 Replies
7. Shell Programming and Scripting
HEllo!!
I need a script in perl that see inside a file(file.txt) that has only one row.
The row contains only this text:
logs_yearly = 20120628113345
I want that the script does this:
"Search in the file, if the date 20120628 is actual date"
Thank you!!
---------- Post... (4 Replies)
Discussion started by: super_sun
4 Replies
8. Shell Programming and Scripting
I need to search for string which is formed from the awk input file in a file given as input through -v option. I tried using the while (getline filename) and match(). But this approach is consuming lot of time as the input file has thousands of records. Please suggest any alternative. Thanks! (0 Replies)
Discussion started by: Cool
0 Replies
9. Shell Programming and Scripting
Hi,
Need your help for this scripting issue I have. I am not really good at this, so seeking your help.
I have a file looking similar to this:
Hello, i am human and name=ABCD.
How are you?
Hello, i am human and name=PQRS.
I am good.
Hello, i am human and name=ABCD.
Good bye.
Hello, i... (12 Replies)
Discussion started by: royzlife
12 Replies
10. UNIX for Beginners Questions & Answers
How to grep for searching a string within a begin and end pattern of a file.
Sent from my Redmi 3S using Tapatalk (8 Replies)
Discussion started by: Baishali
8 Replies
LEARN ABOUT OSX
install-info
INSTALL-INFO(1) User Commands INSTALL-INFO(1)
NAME
install-info - update info/dir entries
SYNOPSIS
install-info [OPTION]... [INFO-FILE [DIR-FILE]]
DESCRIPTION
Install or delete dir entries from INFO-FILE in the Info directory file DIR-FILE.
OPTIONS
--delete
delete existing entries for INFO-FILE from DIR-FILE; don't insert any new entries.
--dir-file=NAME
specify file name of Info directory file. This is equivalent to using the DIR-FILE argument.
--entry=TEXT
insert TEXT as an Info directory entry. TEXT should have the form of an Info menu item line plus zero or more extra lines starting
with whitespace. If you specify more than one entry, they are all added. If you don't specify any entries, they are determined
from information in the Info file itself.
--help display this help and exit.
--info-file=FILE
specify Info file to install in the directory. This is equivalent to using the INFO-FILE argument.
--info-dir=DIR
same as --dir-file=DIR/dir.
--item=TEXT
same as --entry TEXT. An Info directory entry is actually a menu item.
--quiet
suppress warnings.
--remove
same as --delete.
--section=SEC
put this file's entries in section SEC of the directory. If you specify more than one section, all the entries are added in each of
the sections. If you don't specify any sections, they are determined from information in the Info file itself.
--version
display version information and exit.
REPORTING BUGS
Email bug reports to bug-texinfo@gnu.org, general questions and discussion to help-texinfo@gnu.org. Texinfo home page:
http://www.gnu.org/software/texinfo/
COPYRIGHT
Copyright (C) 2004 Free Software Foundation, Inc. There is NO warranty. You may redistribute this software under the terms of the GNU
General Public License. For more information about these matters, see the files named COPYING.
SEE ALSO
The full documentation for install-info is maintained as a Texinfo manual. If the info and install-info programs are properly installed at
your site, the command
info install-info
should give you access to the complete manual.
install-info 4.8 December 2004 INSTALL-INFO(1)