The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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
compare files in two directories and output changed files to third directory bkeep Shell Programming and Scripting 4 08-26-2009 07:58 AM
How to strip ^M at end of each files for all files found in current directory bisip99 Shell Programming and Scripting 4 06-18-2009 05:08 PM
mget * (obtein files from current directory but not the files form sub-directories) Peter321 Shell Programming and Scripting 0 03-12-2009 11:59 AM
how to extract files one by one from a directory and let some processing happen saniya Shell Programming and Scripting 5 05-19-2008 10:02 AM
Processing files within a directory one by one skyineyes Shell Programming and Scripting 1 07-16-2007 02:44 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 08-20-2009
suresh_kb211 suresh_kb211 is offline
Registered User
  
 

Join Date: May 2009
Posts: 28
get all files from a directory and pass the files for processing

Hi All,
I have a directory in which there will be several files. i want to get all the files and pass it to a piece of code for processing on the files.
This is the piece of code which does the processing.


Code:
 
tr "\n" "|" < (log file name) | tr "$" "\n" > output
echo '  ' >>output
 while read line
 do
 sh ParseLog.sh "$line"
 echo $?
 done<output

say i have a directory /user/resin_log , how to get all the files in this directory and pass one by one to this piece of code. Saw a similar query, but couldnt derive anything from that. Please Help. Thanks in advance.

---------- Post updated at 01:10 AM ---------- Previous update was at 12:01 AM ----------

done it with this piece of code. Thank you

Code:
 
ls -lurt /user/resin_log | awk -F ' ' '{print $9}' > file_list
while read line
do
file_name=$line
tr "\n" "|" < (log file name) | tr "$" "\n" > output
echo '  ' >>output
while read line
do
sh ParseLog.sh "$line"
echo $?
done<output
fi
 done <file_list

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:57 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0