※ 引述《[email protected] (奇怪的世界)》之銘言:
> 11111111
> 222222
> 444444
> 666666
> 33333
> 請問鋼如何下指令呢?
如果你不介意暴力法的話.
cp files1 newfiles1
perl -n -e 'chomp($_);`grep ''$_'' files1`; print "$_\n" if($?);' files2 \
>> newfiles1
cat newfiles1 :
11111111
222222
444444
666666
33333
--
※ Origin: 貓坑 CatPit <bbs.cis92.net>
◆ From: academic-pc04.cis.nctu.edu.tw
> -------------------------------------------------------------------------- <
發信人: [email protected] (園丁), 看板: FreeBSD
標 題: Re: 請問如何合併檔案?
發信站: 清華資訊(楓橋驛站) (Thu Oct 31 13:09:06 2002)
轉信站: Ptt!news.ntu!ctu-gate!news.nctu!news.ncu!news.csie.ncu!netnews.csie.nc
cat file1 file2 | sort | uniq > file3
※ 引述《[email protected] (奇怪的世界)》之銘言:
[deleted]
> 有files1 , files2這兩個檔案
[deleted]
> 它不會比較相同的檔案內容,而只是把files2放在files1後面
[deleted]
> 我想做files2合併至files1成為files1,而把重複的去除
> 請問鋼如何下指令呢?