![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Split file into multiple files depending upon first 4 digits | deepakgang | Shell Programming and Scripting | 4 | 04-08-2008 10:21 PM |
| Ksh Storing Multiple Files and reading each line in each file. | developncode | UNIX for Dummies Questions & Answers | 1 | 04-08-2008 01:44 PM |
| Executing Multiple .SQL Files from Single Shell Script file | anushilrai | Shell Programming and Scripting | 3 | 04-07-2008 07:09 AM |
| Help Needed : Split one big file to multiple files | monicasgupta | Shell Programming and Scripting | 5 | 03-03-2008 04:09 PM |
| how to divide single large log file into multiple files. | kamleshm | Shell Programming and Scripting | 1 | 01-15-2008 04:33 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi , this peice of code is working for one file but not for multiple files.
Can some one please tell me the reason??? for i in `ls -1 | egrep ''SOM.*` ; do filename=$(ls -1 $i) filename=$(print $filename) if [[ $filename = *'.pat' ]] then print "Skipping file $i since it already has a .patextension\n" else print "Testing file $i" last_line=$(tail -1 $i) last_line=$(print $last_line) if [[ $last_line = 'FOOTER'* ]] then print "Proper end of file detected" print "Appending $i with .pat extension\n" mv $i $i.pat else print "Proper end of file NOT detected - aborting load....\n" fi fi done Its appending .pat when only one file is there in the directory,but its failing for other files... |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Quote:
Thanks Nagarajan G |
|||
| Google The UNIX and Linux Forums |