| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
|
| Hi all, I am using AIX 5.2 and 5.3 and have to do data migration from old machine to new machine. After migration, I have to do verification. There is a very quick and dirty verification is to ensure the filesize is the same after the migration. The method is very simple: find MyDirectory -type f -ls | awk '{print $11, $7}' To produce a report in both the old and new machine and then use the join command to let the filename (i.e. $11) as key and then compare the 2 filesize values (i.e. $7) This work for 99.9% except when the filename contain SPACE or SPACES. My question is: Can the find -ls command use TAB or other non-space character as the field separator ? If not, any idea to solve this problem ? Hmmmmm, the filename-with-space is really a headache to me for many many times but I have no choice ! Thanks in advance. Alvin SIU |
|
#2
|
| On Thursday 28 August 2008 12:06, Alvin SIU wrote: > Hi all, > > I am using AIX 5.2 and 5.3 > and have to do data migration from old machine to new machine. > > After migration, I have to do verification. > > There is a very quick and dirty verification > is to ensure the filesize is the same after the migration. > > The method is very simple: > find MyDirectory -type f -ls | awk '{print $11, $7}' > > To produce a report in both the old and new machine > and then use the join command to > let the filename (i.e. $11) as key > and then compare the 2 filesize values (i.e. $7) > > This work for 99.9% > except when the filename contain SPACE or SPACES. > > My question is: > Can the find -ls > command use TAB or other non-space character > as the field separator ? I don't know, but you can of course change your awk program. For example: find MyDirectory -type f -ls | \ awk '{s=$7;sub(/^([^[:space:]]*[[:space:]]*){10}/,"");print $0,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. |
|
#3
|
| Alvin SIU wrote: > > I am using AIX 5.2 and 5.3 > and have to do data migration from old machine to new machine. > > After migration, I have to do verification. > > There is a very quick and dirty verification > is to ensure the filesize is the same after the migration. > > The method is very simple: > find MyDirectory -type f -ls | awk '{print $11, $7}' > > To produce a report in both the old and new machine > and then use the join command to > let the filename (i.e. $11) as key > and then compare the 2 filesize values (i.e. $7) > > This work for 99.9% > except when the filename contain SPACE or SPACES. > > My question is: > Can the find -ls > command use TAB or other non-space character > as the field separator ? > > If not, any idea to solve this problem ? find MyDirectory -type f -printf "%p %s\n" John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall |
|
#4
|
| On 8月28日, 下午6時25分, pk > On Thursday 28 August 2008 12:06, Alvin SIU wrote: > > > > > > > Hi all, > > > I am using AIX 5.2 and 5.3 > > and have to do data migration from old machine to new machine. > > > After migration, I have to do verification. > > > There is a very quick and dirty verification > > is to ensure the filesize is the same after the migration. > > > The method is very simple: > > find MyDirectory -type f -ls | awk '{print $11, $7}' > > > To produce a report in both the old and new machine > > and then use the join command to > > let the filename (i.e. $11) as key > > and then compare the 2 filesize values (i.e. $7) > > > This work for 99.9% > > except when the filename contain SPACE or SPACES. > > > My question is: > > Can the find -ls > > command use TAB or other non-space character > > as the field separator ? > > I don't know, but you can of course change your awk program. > For example: > > find MyDirectory -type f -ls | \ > awk '{s=$7;sub(/^([^[:space:]]*[[:space:]]*){10}/,"");print $0,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.- 隱藏被引用文字 - > > - 顯示被引用文字 - Thanks pk, It works. Alvin SIU |
![]() |
| Thread Tools | |
| Display Modes | |