Grep commands in loop


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Grep commands in loop
# 1  
Old 04-28-2008
Grep commands in loop

Hi All,

Reference to my previous post

I need to compare all the lines in the file1 with file2
for this condition if file1 {$3,$5} ==file2 {$3,$5} then grep file2{$1}latest date.

need output in file3
Code:
10/04/2008
09/04/2008
09/04/2008
08/04/2008

can anyone suggest me

Thanks in advance
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Loop to run commands - after the previous instance completed

Hi All, I am trying to call a shell script in a loop. I want my first instance to complete, and then the 2nd instance of the command to start - and so on. eg. I am running this script 30 times. The wrapper script needs business date, from_time,to_time & server_name as inputs. script_name... (2 Replies)
Discussion started by: neil.k
2 Replies

2. Shell Programming and Scripting

How to run the following expect commands in a loop?

spawn fbat expect ">>" send "log fbatPW80_OR8sim1 \r" expect ">>" send "load map.map \r" expect ">>" send "load fbatPW80_OR8sim1.ped \r" expect ">>" send "fbat -v1 \r" expect ">>" send "log off \r" expect ">>" I need the above code to run in a loop such that script keeps doing a... (1 Reply)
Discussion started by: zoeli
1 Replies

3. Shell Programming and Scripting

Help with ls, grep commands

Oracle Linux 6.4/Bash shell I have six files as shown below. Using ls/grep (or anything) , I need to list all files which start with the pattern stomper but not the ones which ends with 1. $ touch stompera $ touch stomperb $ touch stomperc $ touch stompera1 $ touch stomperb1 $ touch... (7 Replies)
Discussion started by: kraljic
7 Replies

4. Shell Programming and Scripting

Grep Commands

I have a text file that has multiple lines in it with multiple dates and years. I was trying to figure out the best way to remove the line that had 2010 and 2011 to an archive file. We only need to keep the 2012 and 2013 lines in the original file. The following is a sample line in the txt file:... (2 Replies)
Discussion started by: smkremer
2 Replies

5. UNIX for Dummies Questions & Answers

[Solved] For Loop with 2 commands? (hostname prob)

Hi I would like to ssh into serveral servers, print the hostname and do an ls (of files in a certain directory), and add these details to a file. so i have this: #!/usr/bin/bash for host in hostnames_here do ssh $host echo "$HOSTNAME" ls /directory_location > ~/new_file_name.txt ... (6 Replies)
Discussion started by: horhif
6 Replies

6. Shell Programming and Scripting

How to run the following expect commands in a loop

#!/usr/bin/expect spawn telnet 1.1.1.1 expect login* send “admin\r” expect Password* send “abcdef123\r” expect “Router#” send “exit\r” I want the above code to run in a loop such that script keeps doing a telnet to the device. Please suggest Tarun (1 Reply)
Discussion started by: tkhanna82
1 Replies

7. UNIX for Dummies Questions & Answers

grep commands

I need your's help to display user with greep command form /etc/passwd 1. to display all login to begin and finishing with letter a or b etc.users admina bserb broota 2. beginning and finishing with the same sign etc. users aghata:.... roootr:....3. to contain what the least three... (1 Reply)
Discussion started by: ViruS89
1 Replies

8. Shell Programming and Scripting

for loop two commands at the end

cat vfiler_volumes.list | while read var1 var2 ; do ssh -n "$var1" df -h "$var2" >> test this part works, however i would like to add an echo $var1 >> test before each ssh iteration. any pointers ? thanx (1 Reply)
Discussion started by: riegersteve
1 Replies

9. Shell Programming and Scripting

For loop and running 2 commands at once?

HI. I am trying to run 2 commands, using the "for x in a b c d" loop but i am having a hard time coding it... Here is what i have so far: for SERVER in SERVERA SERVERB SERVERC SERVERD SERVERE do ############################################################################### #... (5 Replies)
Discussion started by: Stephan
5 Replies

10. Shell Programming and Scripting

Execute commands parallel in a for loop ?

Hi, please can someone point me in the right direction with a shell scripting problem. I want to execute a command in a for loop and the command should be started not one-by-one meaning the for loop is waiting for the exit code , it should be started in parallel. I have a plain text file... (3 Replies)
Discussion started by: networkfre@k
3 Replies
Login or Register to Ask a Question
MERGE(1)						      General Commands Manual							  MERGE(1)

NAME
merge - three-way file merge SYNOPSIS
merge [ options ] file1 file2 file3 DESCRIPTION
merge incorporates all changes that lead from file2 to file3 into file1. The result ordinarily goes into file1. merge is useful for com- bining separate changes to an original. Suppose file2 is the original, and both file1 and file3 are modifications of file2. Then merge combines both changes. A conflict occurs if both file1 and file3 have changes in a common segment of lines. If a conflict is found, merge normally outputs a warning and brackets the conflict with <<<<<<< and >>>>>>> lines. A typical conflict will look like this: <<<<<<< file A lines in file A ======= lines in file B >>>>>>> file B If there are conflicts, the user should edit the result and delete one of the alternatives. OPTIONS
-A Output conflicts using the -A style of diff3(1), if supported by diff3. This merges all changes leading from file2 to file3 into file1, and generates the most verbose output. -E, -e These options specify conflict styles that generate less information than -A. See diff3(1) for details. The default is -E. With -e, merge does not warn about conflicts. -L label This option may be given up to three times, and specifies labels to be used in place of the corresponding file names in conflict reports. That is, merge -L x -L y -L z a b c generates output that looks like it came from files x, y and z instead of from files a, b and c. -p Send results to standard output instead of overwriting file1. -q Quiet; do not warn about conflicts. -V Print 's version number. DIAGNOSTICS
Exit status is 0 for no conflicts, 1 for some conflicts, 2 for trouble. IDENTIFICATION
Author: Walter F. Tichy. Manual Page Revision: 1.1; Release Date: 1999/04/23. Copyright (C) 1982, 1988, 1989 Walter F. Tichy. Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995 Paul Eggert. SEE ALSO
diff3(1), diff(1), rcsmerge(1), co(1). BUGS
It normally does not make sense to merge binary files as if they were text, but merge tries to do it anyway. GNU
1999/04/23 MERGE(1)