Results 1 to 2 of 2

Thread: Redirecting output of script to a file for 100 files

  1. #1
    Junior Member
    Join Date
    Oct 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default Redirecting output of script to a file for 100 files

    After running python script on n files want, to redirect the output to n files( which I have already created). My platform is Linux

    1. Have 100 files with naming convention grid_1.txt, grid_2.txt, ...., grid_100.txt.

    2. Have 100 files named result_grid_1.txt, result_grid_2.txt, ......, result_grid_100.txt.

    3. have to automate the below step for 100 files:
    python grid_1.txt > result_grid_1.txt
    Last edited by chubby_cheeks; 16th October 2011 at 06:15 PM.

  2. #2
    Senior Member cfajohnson's Avatar
    Join Date
    May 2009
    Posts
    190
    Thanks
    0
    Thanked 44 Times in 36 Posts
    Rep Power
    10

    Default


    Code:
    python grid_1.txt | tee result_grid_{1..100}.txt > /dev/null
    Chris F.A. Johnson <http://cfajohnson.com/shell/>
    Shell programmer and author

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [Solved] Howto add shell script in an output file
    By java_girl in forum Shell scripting
    Replies: 4
    Last Post: 4th October 2011, 12:55 AM
  2. [Solved] Redirect output to same file
    By deckoff in forum Shell scripting
    Replies: 2
    Last Post: 3rd August 2011, 12:33 AM
  3. Replies: 9
    Last Post: 21st July 2011, 01:59 AM
  4. Shell Script To Format File Output in HTML Format
    By zerbitated in forum Shell scripting
    Replies: 1
    Last Post: 22nd July 2009, 01:31 AM
  5. shell script output to log file in /var/log/
    By asim.mcp in forum Shell scripting
    Replies: 6
    Last Post: 13th May 2009, 04:04 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •