Sponsored Content
Top Forums Shell Programming and Scripting Using grep with multiple loops in reading files Post 302669577 by Prachi Gupta on Wednesday 11th of July 2012 05:47:43 AM
Old 07-11-2012
I have two files duplicate.txt and Sri1.log

Code:
 
duplicate.txt has
o3EhNzKqTwIhcMxg101209090000024_1
IUxBNzKlZfghcMxf101209090000024_1

Code:
 
Sri1.log has
2012-05-09 10:29:14.285 | SYNC  | 00050 | DEBUG   |  Payment | Exchange ...  | Exchange sent   ....   | B678C56D-96DA-4FFC-B40E-9A032A2EB12E-0000003  | xengine......           | {previous....., Split, exchange-properties={ClaimSystemID=MS,......, RemittanceId=IUxBNzKlZfghcMxf101209090000024_1, .....}

2012-05-09 10:34:51.920 | SYNC  | 00052 | DEBUG   | EUO_Main Remittance Flow | Exchange        | Exchange ..... | AF4B93E6-7DFF-49E6-8AA3-065AA09A01C7-0000000  | service.adapter:UCF Version Creator | {previous-component...., RemitProcessingID=014BB9C7-B83E-48FC-9745-6A8A45F8F9AD, RemittanceId=o3EhNzKqTwIhcMxg101209090000024_1,......}
2012-05-09 10:28:47.942 | SYNC  | 00040 | INFO    | Customer_Receive Payment | Task            | Task started                           | B678C56D-96DA-4FFC-B40E-9A032A2EB12E          | filesystem:CERR                     | {}

Code:
 
Output Required
 B678C56D-96DA-4FFC-B40E-9A032A2EB12E-0000003
AF4B93E6-7DFF-49E6-8AA3-065AA09A01C7-0000000

I want value only if line has the text searched from the first file
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Reading multiple tags from .asx files

Hi, I'm trying to wget a series of .asx files, read <title> and <ref> tags from them and then sending that information to wget. asx files contains the following information <ASX VERSION="3.0"> <ENTRY> <STARTTIME Value="00:00:00.0" /> <TITLE>title of the movie</TITLE> <REF... (0 Replies)
Discussion started by: underlig
0 Replies

2. Shell Programming and Scripting

Reading files using grep/sed/awk

After pouring over my LTKS and Unix in a nutshell, I'm stuck! I have a large (BMC Report File) that has breaks on DM (district managers). After a report header, there is a DM header like: DM: DBP AARON ROBERTS At the end of each DM break, there is: ** END OF REPORT ** ... (6 Replies)
Discussion started by: Jodyman
6 Replies

3. Shell Programming and Scripting

reading multiple files

Hello I have a requirement where i have to loop through certain directory which will have multiple files. After looping through i have to make a list of file names exisitng in the directory and write them to a sequental file and each file should be delimited by ^%^ i.e If i have 3 files A,... (3 Replies)
Discussion started by: dsdev_123
3 Replies

4. Shell Programming and Scripting

file reading in nested loops

I have to to read files simultaneously in two nested loops,but am getting error can anyone do the needful. useridFile=userIds.txt fname=kiran.txt exec<$useridFile while read line do echo "User IDs are..$line" USER_ID=$line REMOTE_DIR_LOCATION="/home/test/$USER_ID" SOURCE_DIR=$USER_ID... (1 Reply)
Discussion started by: KiranKumarKarre
1 Replies

5. UNIX for Dummies Questions & Answers

Reading compressed files during a grep search

All, The bottom line is that im reading a file, storing it as variables, recursively grep searching it, and then piping it to allow word counts as well. I am unsure on how to open any .zip .tar and .gzip, search for keywords and return results. Any help would be much appreciated! Thanks (6 Replies)
Discussion started by: ryan.lee
6 Replies

6. UNIX for Dummies Questions & Answers

Grep multiple strings in multiple files using single command

Hi, I will use below command for grep single string ("osuser" is search string) ex: find . -type f | xarg grep -il osuser but i have one more string "v$session" here i want to grep in which file these two strings are present. any help is appreciated, Thanks in advance. Gagan (2 Replies)
Discussion started by: gagan4599
2 Replies

7. UNIX for Dummies Questions & Answers

Reading and writing data to and from multiple files

Hi, I have several text files. One main file contains the detail data, other have some information to extract data from the main file, and some are empty files. Examples are shown below: The main file look like: MainFile.txt >Header1 data1...data1... >Header2 data2...data2... ... ...... (2 Replies)
Discussion started by: Fahmida
2 Replies

8. Shell Programming and Scripting

reading information from a table and apply a command on multiple files

Hey gyuz, I wanna calculate the number of mapped reads of a bam file in a region of interest. I used this code to do so : samtools view input.bam chrname:region1 > region1.txt This will store all the reads from given bam file within the region of interest in region1.txt Now I have... (5 Replies)
Discussion started by: @man
5 Replies

9. Shell Programming and Scripting

Grep strings on multiple files and output to multiple files

Hi All, I want to use egrep on multiple files and the results should be output to multiple files. I am using the below code in my shell script(working in Ksh shell). However with this code I am not attaining the desired results. #!/bin/ksh ( a="/path/file1" b="path/file2" for file in... (4 Replies)
Discussion started by: am24
4 Replies

10. Shell Programming and Scripting

Ssh to multiple hosts and then run multiple for loops under remote session

Hello, I am trying to login to multiple servers and i have to run multiple loops to gather some details..Could you please help me out. I am specifically facing issues while running for loops. I have to run multiple for loops in else condition. but the below code is giving errors in for... (2 Replies)
Discussion started by: mohit_vardhani
2 Replies
XZGREP(1)							     XZ Utils								 XZGREP(1)

NAME
xzgrep - search compressed files for a regular expression SYNOPSIS
xzgrep [grep_options] [-e] pattern file... xzegrep ... xzfgrep ... lzgrep ... lzegrep ... lzfgrep ... DESCRIPTION
xzgrep invokes grep(1) on files which may be either uncompressed or compressed with xz(1), lzma(1), gzip(1), or bzip2(1). All options specified are passed directly to grep(1). If no file is specified, then standard input is decompressed if necessary and fed to grep(1). When reading from standard input, gzip(1) and bzip2(1) compressed files are not supported. If xzgrep is invoked as xzegrep or xzfgrep then egrep(1) or fgrep(1) is used instead of grep(1). The same applies to names lzgrep, lze- grep, and lzfgrep, which are provided for backward compatibility with LZMA Utils. ENVIRONMENT
GREP If the GREP environment variable is set, xzgrep uses it instead of grep(1), egrep(1), or fgrep(1). SEE ALSO
grep(1), xz(1), gzip(1), bzip2(1), zgrep(1) Tukaani 2010-09-27 XZGREP(1)
All times are GMT -4. The time now is 07:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy