![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Check File Exists and compare to previous day file script | rbknisely | Shell Programming and Scripting | 3 | 02-07-2008 11:53 AM |
| compare file size from a output file from a script | moustik | Shell Programming and Scripting | 7 | 11-07-2007 10:17 AM |
| compare 2 file and print difference in the third file URG PLS | evvander | Shell Programming and Scripting | 3 | 09-24-2007 06:52 AM |
| File Compare and Create New File with Diff | guiguy | UNIX for Advanced & Expert Users | 7 | 02-28-2007 06:43 AM |
| How to compare prev day file to current day file | Smurtzy | Shell Programming and Scripting | 1 | 12-05-2001 07:33 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Sort and compare file
If I have 3 kinds of files in directory DATA1:
FileA.20060315.dat, FileB.20060315.dat, FileC.20060315.dat FileC.20060316.dat FileA.20060317.dat, FileB.20060317.dat FileA.20060318.dat, FileB.20060318.dat, FileC.20060318.dat If 3 files have the same date then run $cat FileA.20060315.dat FileB.20060315.dat FileC.20060315.dat > FileD.20060315.dat and move these files to DATA2 . if it doesnot have 3 files the same date then move it to DATA3 ??? How do you know what date to choose ? Code:
#!/bin/ksh
cd ./DATA1
for file in *.dat; do
ls -1 $file|awk -F"-" '{
filedt = substr($2,1,8);
{
printf "%s\n",filedt
}
}' >> checkit;
done
cat checkit | sort -n |uniq > date.srt
20060316 20060317 20060318 I get file sort by date then how I check date by date ? do you know ? |
|
||||
|
wow, thanks, would you please explain for me the lines
if [[ -f FileB${i#FileA} && -f FileC${i#FileA} ]] ; then cat $i FileB${i#FileA} FileC${i#FileA} > FileD${i#FileA} I try to understand what does it mean. if [[ -f FileB${i#FileA} && -f FileC${i#FileA} ]] --> if the fileB and file C have the same date with file A ??? |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|