03-06-2007
how to check for pattern in other file
i hav file1
with contents:
welcome
this is first file
file name is file 1
last line of the file
now i want to check if the second line has sentence "this is first file" through
"if" statement from another file ...
is it possible if so how!!!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I want to determine whether a specific pattern is present within a line or not
e.g.
The whole line is in a varaible called VALUE
VALUE="(ABC, DEF, NMF, ABC, CLF, PAR, FHG, AGQSAs, sada, sa, ABC)"
i want to set a flag to 1 if i find the presence of ABC in the above variable.
Please... (8 Replies)
Discussion started by: skyineyes
8 Replies
2. Shell Programming and Scripting
Hi,
I have a script where I supply a parameter externally. Now when the script picks up the parameter, I want to verify if that parameter has a pattern such as "tag" in it.
I know that after reading the param the script can push it to a file and grep for the pattern, but I am looking for a... (2 Replies)
Discussion started by: sumeet
2 Replies
3. Shell Programming and Scripting
Hello friends,
I am writing a simple shell script which will copy one particular type of files to backup folder if files exists. If files doesn't exists, mv command should not be executed.
My file pattern is like wcm-spider-maestro.log.2009-07-15, wcm-spider-maestro.log.2009-07-16 etc..
I... (6 Replies)
Discussion started by: sreenu.shell
6 Replies
4. Shell Programming and Scripting
I want to check the files if the below pattern is there or not. I have to scan thousands of files.
It should start search with "Group" (Case insensitive) and followed by first semicolon ";" . In between these two there should be "partition"(case insensitive).
File1.txt
a)
update... (1 Reply)
Discussion started by: smolakal
1 Replies
5. Shell Programming and Scripting
HI Guys ,
Using UNIX ,I intend to check with correct file pattern Access_file_Record.YYYYMM in path /tmp
If the file exist in correct format come out from code .
If not found check with different file patterns for same month period YYYYMM ( Like Access_file_Record_YYYYMM.txt or... (8 Replies)
Discussion started by: Perlbaby
8 Replies
6. Shell Programming and Scripting
Hi ! All
I just want to search and write to new file if pattern is found in text file
following are my text files by which I want to search Month and last column number
my text file1
15-Jan-2011 25 ARTS 1255 125 125 178 198
15-Jan-2011 25 ARTS 1255 125 125 178 198
15-Jan-2011 25... (3 Replies)
Discussion started by: nex_asp
3 Replies
7. UNIX for Dummies Questions & Answers
Hey Guys and Gals,
I am having trouble with what I thought shouldn't be hard..
In a script I am working on there is a need to enter a MAC address.
MAC addresses are formatted ;
XX:XX:XX:XX:XX:XX
where X can be 0-9, a-f or A-F
So in the sample script the query is something... (4 Replies)
Discussion started by: TAPE
4 Replies
8. Shell Programming and Scripting
hi!
im new here and to unix.
I want to do something with our log files. to compare two log files for a certain pattern.
sample:
file1.log contains all the "successful" run of a procedure.
file2.log contains all the "current" running procedures.
sample line from file1.log... (5 Replies)
Discussion started by: cabs_14
5 Replies
9. Shell Programming and Scripting
Hi
I need to do a patten match between files .
I am new to shell scripting and have come up with this so far. It take 50 seconds to process files of 2mb size . I need to tune this code as file size will be around 50mb and need to save time.
Main issue is that I need to search the pattern from... (2 Replies)
Discussion started by: nitin_daharwal
2 Replies
10. Shell Programming and Scripting
Hi,
I've a file with content as below
first_block_list{
a:5
b:3
c:8
}
new_store_list(
a:1000
b:200
c:3343
)
first_item_list{
a:10
b:20
c:30
}
second_item_list{ (1 Reply)
Discussion started by: ratheeshp
1 Replies
DIFF(1) General Commands Manual DIFF(1)
NAME
diff - print differences between two files
SYNOPSIS
diff [-c | -e | -C n] [-br]file1 file2
OPTIONS
-C n Produce output that contains n lines of context
-b Ignore white space when comparing
-c Produce output that contains three lines of context
-e Produce an ed-script to convert file1 into file2
-r Apply diff recursively to files and directories of
EXAMPLES
diff file1 file2 # Print differences between 2 files
diff -C 0 file1 file2
# Same as above
diff -C 3 file1 file2
# Output three lines of context with every
diff -c file1 file2 # Same
diff /etc /dev # Compares recursively the directories /etc and /dev
diff passwd /etc # Compares ./passwd to /etc/passwd
DESCRIPTION
the same name, when file1 and file2 are both directories" difference encountered"
Diff compares two files and generates a list of lines telling how the two files differ. Lines may not be longer than 128 characters. If
the two arguments on the command line are both directories, diff recursively steps through all subdirectories comparing files of the same
name. If a file name is found only in one directory, a diagnostic message is written to stdout. A file that is of either block special,
character special or FIFO special type, cannot be compared to any other file. On the other hand, if there is one directory and one file
given on the command line, diff tries to compare the file with the same name as file in the directory directory.
SEE ALSO
cdiff(1), cmp(1), comm(1), patch(1).
DIFF(1)