How list of files as input


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How list of files as input
# 1  
Old 06-25-2007
How list of files as input

ls -l $FILEDIR | awk '{print $9,",",$6,$7,",",$8}' < $FILELIST > $TARGTDIR


the above script im trying ,but im not get expected result.

can any help.

here im passing $FILELIST as List of files(input)
# 2  
Old 06-25-2007
Quote:
Originally Posted by laknar
ls -l $FILEDIR | awk '{print $9,",",$6,$7,",",$8}' < $FILELIST > $TARGTDIR


the above script im trying ,but im not get expected result.

can any help.

here im passing $FILELIST as List of files(input)
If you want the details of files in $FILELIST in directory $FILEDIR, then try this
Code:
while read file
do
ls -l $FILEDIR"/"$file | awk '{print $9,",",$6,$7,",",$8}' > $TARGTDIR
done < $FILELIST

# 3  
Old 06-25-2007
Just a little modification to anbu23' solution :
Code:
while read file
do
ls -l $FILEDIR"/"$file | awk '{print $9,",",$6,$7,",",$8}' >> $TARGTDIR
done < $FILELIST

Another way:
Code:
ls -l $FILEDIR |
awk '
   NR==FNR   { ++Files[$1] ; next }
   Files[$9] { print $9,",",$6,$7,",",$8 } 
' $FILELIST - > $TARGETDIR

# 4  
Old 06-25-2007
hi,

u can try the following code:
cd $FILEDIR
awk '{print $9,",",$6,$7,",",$8}' $FILELIST > $TARGTDIR
cd -
# 5  
Old 06-25-2007
Thank You,

Its working fine.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Cpio - input files (from list) are stored in different order inside cpio archive - why?

Due to budget constraints I have to reinvent an Enterprise backup system in a SPARC (sun4v) Solaris estate (10 & 11). (yep - reinvent wheel, fun but time consuming. Is this wise?! :confused: ) For each filesystem of interest, to try to capture a 'catalog' at the front of each cpio archive (for... (1 Reply)
Discussion started by: am115998
1 Replies

2. Shell Programming and Scripting

Verify input parameter is in the list

I need write a Korn shell which accept input parameter. But this input paramter must match one of the string in an existsing file (listkeyword). Can someone one help, how this can be done ? (3 Replies)
Discussion started by: cpchiu
3 Replies

3. Shell Programming and Scripting

Read input files and merge them in given order and write them to input one param or one file

Dear Friends, I am looking for a shell script to merge input files into one file .. here is my idea: 1st paramter would be outfile file (all input files content) read all input files and merge them to input param 1 ex: if I pass 6 file names to the script then 1st file name as output file... (4 Replies)
Discussion started by: hyd1234
4 Replies

4. Shell Programming and Scripting

[Solved] Multiple input files and output files

Hi, I have many test*.ft1 files to which I want to read as input for a script called pipe2txt.tcl and print the output in each separate file. For example, pipe2txt.tcl < test001.ft1 > test001.txt How can I read many files in this maner? thank you very much, Best, Pahuja (5 Replies)
Discussion started by: Pahuja
5 Replies

5. UNIX for Advanced & Expert Users

Help with ksh script to list, then cp files from a user input date range

Hi, I'm quite new to ksh scripting, can someone help me with this. Requirements: I need to create a script that list the files from a user input date range. e. g. format of file: *c1*log.2012-12-22-14-00* *c1*log.2012-12-22-14-00* *c1*log.2012-12-22-14-00*... (1 Reply)
Discussion started by: chococrunch6
1 Replies

6. Shell Programming and Scripting

Script to delete files with an input for directories and an input for path/file

Hello, I'm trying to figure out how best to approach this script, and I have very little experience, so I could use all the help I can get. :wall: I regularly need to delete files from many directories. A file with the same name may exist any number of times in different subdirectories.... (3 Replies)
Discussion started by: *ShadowCat*
3 Replies

7. Shell Programming and Scripting

Separating list of input files (*.file) with a comma in bash script

Hi all, I'm trying to get a bash script working for a program (bowtie) which takes a list of input files (*.fastq) and assembles them to an output file (outfile.sam). All the .fastq files are in one folder in my home directory (~/infiles). The problem is that the 'bowtie' requires that... (7 Replies)
Discussion started by: TuAd
7 Replies

8. Shell Programming and Scripting

Reading specific contents from 1 input files and appending it to another input file

Hi guys, I am new to AWK and unix scripting. Please see below my problem and let me know if anyone you can help. I have 2 input files (example given below) Input file 2 is a standard file (it will not change) and we have to get the name (second column after comma) from it and append it... (5 Replies)
Discussion started by: sksahu
5 Replies

9. Shell Programming and Scripting

Splitting input files into multiple files through AWK command

Hi, I needs to split *.txt files from single directory depends on the some mutltiple input values. i have wrote the code like below for file in *.txt do grep -i -h "value1|value2" $file > $file; done. My requirment is more input values needs to be given in grep; let us say 50... (3 Replies)
Discussion started by: arund_01
3 Replies

10. UNIX for Dummies Questions & Answers

Search a string from list of input files

Hello, I am trying to match a string between line one and line two with in the file. But I dont want to search based on the given filename. Instead I want to search for all available files in the specific directory. Please help me on the above. (2 Replies)
Discussion started by: sivakumarvenkat
2 Replies
Login or Register to Ask a Question