Sponsored Content
Full Discussion: Grep lines accordingly
Top Forums UNIX for Advanced & Expert Users Grep lines accordingly Post 302952957 by disedorgue on Monday 24th of August 2015 02:08:28 PM
Old 08-24-2015
Hi,
For fun (under linux for "xargs"):
Code:
$ sort file1 file2 file2 | uniq -u | xargs -IXX echo path XX is missing 
path /dell/sony/ is missing
path /dev/testcase failing is missing

Regards.
This User Gave Thanks to disedorgue For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

grep + lines after

Hello again, I'm still working on the redo of my script I created before and came across a grep question. I'm on SunOS 5.9 and using the Korn Shell. I'm writing a function to check for validation of root disks being mirrored. If the server allows me to use metastat, I'm looking to show it has... (4 Replies)
Discussion started by: Janus
4 Replies

2. Shell Programming and Scripting

grep and fetching lines after grep

suppose i have a file structure(serial file)-- ---------- ---------- --------- summery -------- ------ -------- finished ----- ------- i want to fetch lines from summery to finished i can get line of summery by grep command. but how can i fetch lines untill it reaches finished.probably... (2 Replies)
Discussion started by: arghya_owen
2 Replies

3. Shell Programming and Scripting

Grep and delete lines except the lines with strings

Hi I am writing a script which should read a file and search for certain strings 'approved' or 'removed' and retain only those lines that contain the above strings. Ex: file name 'test' test: approved package waiting for approval package disapproved package removed package approved... (14 Replies)
Discussion started by: vj8436
14 Replies

4. Shell Programming and Scripting

AIX equivalent to GNU grep's -B and -A [print lines after or before matching lines]

Hi folks I am not allowed to install GNU grep on AIX. Here my code excerpt: grep_fatal () { /usr/sfw/bin/gegrep -B4 -A2 "FATAL|QUEUE|SIGHUP" } Howto the same on AIX based machine? from manual GNU grep ‘--after-context=num’ Print num lines of trailing context after... (4 Replies)
Discussion started by: slashdotweenie
4 Replies

5. Shell Programming and Scripting

Print lines between two lines after grep for a text string

I have several very large file that are extracts from Oracle tables. These files are formatted in XML type syntax with multiple entries like: <ROW> some information more information </ROW> I want to grep for some words, then print all lines between <ROW> AND </ROW>. Can this be done with AWK?... (7 Replies)
Discussion started by: jbruce
7 Replies

6. Shell Programming and Scripting

Perl XML, find matching condition and grep lines and put the lines somewhere else

Hi, my xml files looks something like this <Instance Name="New York"> <Description></Description> <Instance Name="A"> <Description></Description> <PropertyValue Key="false" Name="Building A" /> </Instance> <Instance Name="B"> ... (4 Replies)
Discussion started by: tententen
4 Replies

7. Shell Programming and Scripting

Extracting specific lines of data from a file and related lines of data based on a grep value range?

Hi, I have one file, say file 1, that has data like below where 19900107 is the date, 19900107 12 144 129 0.7380047 19900108 12 168 129 0.3149017 19900109 12 192 129 3.2766666E-02 ... (3 Replies)
Discussion started by: Wynner
3 Replies

8. Shell Programming and Scripting

AWK/GREP: grep only lines starting with integer

I have an input file 12.4 1.72849432773174e+01 -7.74784188610632e+01 12.5 9.59432114416327e-01 -7.87018212757537e+01 15.6 5.20139995965960e-01 -5.61612429666624e+01 29.3 3.76696387248366e+00 -7.42896194101892e+01 32.1 1.86899877018077e+01 -7.56508762501408e+01 35 6.98857157014640e+00... (2 Replies)
Discussion started by: chrisjorg
2 Replies

9. Shell Programming and Scripting

Grep couple of consecutive lines if each lines contains certain string

Hello, I want to extract from a file like : 20120530025502914 | REQUEST | whatever 20120530025502968 | RESPONSE | whatever 20120530025502985 | RESPONSE | whatever 20120530025502996 | REQUEST | whatever 20120530025503013 | REQUEST | whatever 20120530025503045 | RESPONSE | whatever I want... (14 Replies)
Discussion started by: black_fender
14 Replies

10. Shell Programming and Scripting

Grep three consecutive lines if each lines contains certain string

say we have : 2914 | REQUEST | whatever 2914 | RESPONSE | whatever 2914 | SUCCESS | whatever 2985 | RESPONSE | whatever 2986 | REQUEST | whatever 2990 | REQUEST | whatever 2985 | RESPONSE | whatever 2996 | REQUEST | whatever 2010 | SUCCESS | whatever 2013 | REQUEST | whatever 2013 |... (7 Replies)
Discussion started by: Saumitra Pandey
7 Replies
cmp(1)								   User Commands							    cmp(1)

NAME
cmp - compare two files SYNOPSIS
cmp [-l] [-s] file1 file2 [skip1] [skip2] DESCRIPTION
The cmp utility compares two files. cmp will write no output if the files are the same. Under default options, if they differ, it writes to standard output the byte and line numbers at which the first difference occurred. Bytes and lines are numbered beginning with 1. If one file is an initial subsequence of the other, that fact is noted. skip1 and skip2 are initial byte offsets into file1 and file2 respec- tively, and may be either octal or decimal; a leading 0 denotes octal. OPTIONS
The following options are supported: -l Write the byte number (decimal) and the differing bytes (octal) for each difference. -s Write nothing for differing files; return exit statuses only. OPERANDS
The following operands are supported: file1 A path name of the first file to be compared. If file1 is -, the standard input will be used. file2 A path name of the second file to be compared. If file2 is -, the standard input will be used. If both file1 and file2 refer to standard input or refer to the same FIFO special, block special or character special file, an error results. USAGE
See largefile(5) for the description of the behavior of cmp when encountering files greater than or equal to 2 Gbyte (2**31 bytes). EXAMPLES
Example 1: Comparing files byte for byte The following example: example% cmp file1 file2 0 1024 does a byte for byte comparison of file1 and file2. It skips the first 1024 bytes in file2 before starting the comparison. ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of cmp: LANG, LC_ALL, LC_CTYPE, LC_MES- SAGES, and NLSPATH. EXIT STATUS
The following error values are returned: 0 The files are identical. 1 The files are different; this includes the case where one file is identical to the first part of the other. >1 An error occurred. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |CSI |enabled | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
comm(1), diff(1), attributes(5), environ(5), largefile(5), standards(5) SunOS 5.10 1 Feb 1995 cmp(1)
All times are GMT -4. The time now is 08:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy