DIFF command

  • Follow


I am a unix newbie.  I am using the DIFF command to compare two text
files.  My unix command is
diff P_FILE1 P_FILE2 > P_FILE3

I get the results in this format

1c1
< 0000000000000608114104S977    200412012004580000000011391.985SU S977
---
> 0000000000000608114104S977    200412012004580000000001391.985SU S977      7,8c7,8
< 0000000000000608114104S977    200411082004540000000011793.170SU S977
< 0000000000000608111234S977    200411082004540000000011793.170SU S977
---
> 0000000000000608114104S977    200411082004540000000001793.170SU S977      
> 0000000000000608114856S977    200411082004540000000001793.170SU S977      

How can I exclude the '<', '1c1', '---', '7,8c7,8' information from
the output file P_FILE3?
Thanks.
Ryan
0
Reply assum.sr (1) 4/4/2004 11:19:53 PM

assum.sr@pg.com (Sandy) wrote:
# I am a unix newbie.  I am using the DIFF command to compare two text
# files.  My unix command is
# diff P_FILE1 P_FILE2 > P_FILE3
# 
# I get the results in this format
# 
# 1c1
# < 0000000000000608114104S977    200412012004580000000011391.985SU S977
# ---
# > 0000000000000608114104S977    200412012004580000000001391.985SU S977      7,8c7,8
# < 0000000000000608114104S977    200411082004540000000011793.170SU S977
# < 0000000000000608111234S977    200411082004540000000011793.170SU S977
# ---
# > 0000000000000608114104S977    200411082004540000000001793.170SU S977      
# > 0000000000000608114856S977    200411082004540000000001793.170SU S977      
# 
# How can I exclude the '<', '1c1', '---', '7,8c7,8' information from
# the output file P_FILE3?

Pipe through grep. I'm not sure of the precise syntax, but you can try
something like
	diff P_FILE1 P_FILE2 | egrep '^>' > P_FILE3

--
Derk Gwen http://derkgwen.250free.com/html/index.html
If your job was as meaningless as theirs, wouldn't you go crazy too?
0
Reply Derk 4/5/2004 12:55:50 AM


You may try 'grep' as this:
cat P_FILE3 | grep -v "^<" | grep -v "^---" | grep "^>"


"Sandy" <assum.sr@pg.com> wrote in message
news:51d71336.0404041519.7233540a@posting.google.com...
> I am a unix newbie.  I am using the DIFF command to compare two text
> files.  My unix command is
> diff P_FILE1 P_FILE2 > P_FILE3
>
> I get the results in this format
>
> 1c1
> < 0000000000000608114104S977    200412012004580000000011391.985SU S977
> ---
> > 0000000000000608114104S977    200412012004580000000001391.985SU S977
7,8c7,8
> < 0000000000000608114104S977    200411082004540000000011793.170SU S977
> < 0000000000000608111234S977    200411082004540000000011793.170SU S977
> ---
> > 0000000000000608114104S977    200411082004540000000001793.170SU S977
> > 0000000000000608114856S977    200411082004540000000001793.170SU S977
>
> How can I exclude the '<', '1c1', '---', '7,8c7,8' information from
> the output file P_FILE3?
> Thanks.
> Ryan


0
Reply Liang 4/5/2004 1:34:01 AM

Sandy <assum.sr@pg.com> wrote:
: I am a unix newbie.  I am using the DIFF command to compare two text
: files.  My unix command is
: diff P_FILE1 P_FILE2 > P_FILE3

: I get the results in this format

: 1c1
: How can I exclude the '<', '1c1', '---', '7,8c7,8' information from
: the output file P_FILE3?

Try diff -u or comm

-- 
All language designers are arrogant. Goes with the territory...
	-- Larry Wall
0
Reply vitus 4/5/2004 4:58:42 AM

3 Replies
751 Views

(page loaded in 0.093 seconds)

Similiar Articles:













7/20/2012 3:47:29 AM


Reply: