|
Prev: remove from a txt everything between '[' and '] ' (included '[' and '] ')
Next: incomplete printout ending on german umlauts with SLES9 due to LC_-settings from /etc/csh.cshrc
From: Kevin Qin on 3 Apr 2008 12:13 Hi, I ftped some text file from unix server to my Win PC. I installed cygwin in my PC and want to compare the unix text and dos text with diff command. How can I remove the influence by carriage return? Even same text file, diff will show different result. I know the options "-b" can remove this. At the same time, the option will remove all blanks. However, I also want to compare blank and tab number in two files. Any comment will be appreciated. -Kevin
From: Ed Morton on 3 Apr 2008 12:17 On 4/3/2008 11:13 AM, Kevin Qin wrote: > Hi, > I ftped some text file from unix server to my Win PC. > I installed cygwin in my PC and want to compare the unix text and dos > text with diff command. > How can I remove the influence by carriage return? > > Even same text file, diff will show different result. > I know the options "-b" can remove this. At the same time, the option > will remove all blanks. > > However, I also want to compare blank and tab number in two files. > > Any comment will be appreciated. > > -Kevin man dos2unix Ed.
From: Kevin Qin on 3 Apr 2008 12:23 On Apr 4, 12:17 am, Ed Morton <mor...(a)lsupcaemnt.com> wrote: > On 4/3/2008 11:13 AM, Kevin Qin wrote: > > > Hi, > > I ftped some text file from unix server to my Win PC. > > I installed cygwin in my PC and want to compare the unix text and dos > > text with diff command. > > How can I remove the influence by carriage return? > > > Even same text file, diff will show different result. > > I know the options "-b" can remove this. At the same time, the option > > will remove all blanks. > > > However, I also want to compare blank and tab number in two files. > > > Any comment will be appreciated. > > > -Kevin > > man dos2unix > > Ed. Thank you for your input. I know that the command u2d can convert unix text to dos text. Is there one way that we can compare the two files with diff command directly?
From: pk on 3 Apr 2008 12:39 Kevin Qin wrote: > Hi, > I ftped some text file from unix server to my Win PC. > I installed cygwin in my PC and want to compare the unix text and dos > text with diff command. > How can I remove the influence by carriage return? > > Even same text file, diff will show different result. > I know the options "-b" can remove this. At the same time, the option > will remove all blanks. > > However, I also want to compare blank and tab number in two files. > > Any comment will be appreciated. This works with bash, but it's not standard and I don't know whether it works under cygwin at all: diff <(cat unixfile | unix2dos) dosfile or diff unixfile <(cat dosfile | dos2unix) If you don't have dos2unix or unix2dos, they can be implemented using sed one-liners: unix2dos: sed 's/$/\r/' (GNU sed) dos2unix: sed 's/.$//' -- All the commands are tested with bash and GNU tools, so they may use nonstandard features. I try to mention when something is nonstandard (if I'm aware of that), but I may miss something. Corrections are welcome.
From: Chris Mattern on 3 Apr 2008 16:17
On 2008-04-03, Kevin Qin <sas.runner(a)gmail.com> wrote: > On Apr 4, 12:17 am, Ed Morton <mor...(a)lsupcaemnt.com> wrote: >> On 4/3/2008 11:13 AM, Kevin Qin wrote: >> >> > Hi, >> > I ftped some text file from unix server to my Win PC. >> > I installed cygwin in my PC and want to compare the unix text and dos >> > text with diff command. >> > How can I remove the influence by carriage return? >> >> > Even same text file, diff will show different result. >> > I know the options "-b" can remove this. At the same time, the option >> > will remove all blanks. >> >> > However, I also want to compare blank and tab number in two files. >> >> > Any comment will be appreciated. >> >> > -Kevin >> >> man dos2unix >> >> Ed. > > Thank you for your input. > I know that the command u2d can convert unix text to dos text. > Is there one way that we can compare the two files with diff command > directly? If you have GNU dos2unix, you can just use it as part of a pipe: cat a.txt | dos2unix | diff - b.txt Note that this doesn't work with less capable dos2unixes, like the one that comes with Solaris. -- Christopher Mattern NOTICE Thank you for noticing this new notice Your noticing it has been noted And will be reported to the authorities |