Computing.Net > Forums > Programming > Help : Bash script to access all fi

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Help : Bash script to access all fi

Reply to Message Icon

Name: shinni
Date: January 30, 2005 at 21:41:47 Pacific
OS: Linux
CPU/Ram: P4,256
Comment:

I need soem help regaridng one script i want to write. I am a new bie in
writing scripts, so this doubt may be a simple one.

I am trying to apply a parsing program to a set of input files in a directoy.
How can i access all the files from a source directory , one by one and to
write the
output files with another name to some directory ? i.e
my exe file is a.out
I have input files 1.txt,2.txt .. in one directory.
I need this cmd line ./a.out <inputfilename> > <outputfilename> , on all
input files.

can i write a loop to get all files like this ? right now i am writing the
same line
again and again to apply to all files..

Plz give your suggestions.


Thank u

Shinni



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: January 31, 2005 at 00:02:22 Pacific
Reply:

I think you should try the linux forum.

M2


0

Response Number 2
Name: FishMonger
Date: January 31, 2005 at 15:20:26 Pacific
Reply:

I'm a Perl guy and only know the barest minumum of Bash, so this syntax might be a little off.

#!/bin/bash

for file in *txt
do
    $num++
    ./a.out $file > $num.out
done


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Help : Bash script to access all fi

Bash script to start application www.computing.net/answers/programming/bash-script-to-start-application/18255.html

Script to remove lines from a file www.computing.net/answers/programming/script-to-remove-lines-from-a-file/7090.html

Bash script help www.computing.net/answers/programming/bash-script-help/10720.html