Convert Text within multipul files - for loop


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Convert Text within multipul files - for loop
# 1  
Old 04-27-2009
Convert Text within multipul files - for loop

Is this possible?

Code:
#!/bin/ksh
for file in `*.idlesince` 
do
  while read inter time
  do
    printf "%s %s\n" "${inter}" "$(perl -e 'print scalar localtime('"${time}"') . "\n";')" >> "${file}.done"
  done < "${file}"
done

The error I get is
Code:
line 9: router.idlesince: command not found

# 2  
Old 04-27-2009
Code:
#!/bin/ksh
for file in *.idlesince

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Read .xlsx and text files in a loop using openpyxl

I have a list of .xlsx files (names 1.xlsx, 2.xlsx etc) in a directory, on which I need to insert data from its corresponding text file (named 1.txt, 2.txt etc) on the second worksheet named 'Filtered' and save it. The code I am trying is #!/usr/bin/python import os from... (8 Replies)
Discussion started by: nans
8 Replies

2. Shell Programming and Scripting

Loop to convert text output in the HTML format

Hello Everyone, I have a sample file raw.txt as shown below : Drive Bays Bay Name : SD-2C Number of Standby Power Supplies : 4 Number of Drive Enclosures : 12 Summary Status of Contained Modules All... (6 Replies)
Discussion started by: rahul2662
6 Replies

3. Shell Programming and Scripting

Loop through the dir and Rename zip files and their underlying text file.

I have files in the ABC_YYYYMMDD.zip format under a directory. Each zip file contains A text file in the ABC_YYYYMMDD.txt format. I am trying to create a script that will Rename the zip files and their underlying text file replacing the datepart in them with . For eg: in the case of... (1 Reply)
Discussion started by: bash987
1 Replies

4. Shell Programming and Scripting

How to loop a text file to remove the old files?

Hi , I'm using Ksh 88 version. I've a text file which contains the directory names DIR1 DIR2 ---- DIR10 I've to remove the data which has more that 30 days from the above directories . The data has to be removed from the following path cd /home/etc/DIR1/hist cd /home/etc/DIR2/hist... (2 Replies)
Discussion started by: smile689
2 Replies

5. Shell Programming and Scripting

How to convert AFP files to Text?

Hi I am trying to locate a unix utility to convert AFP files to readable text format There are plenty of windows tools, but I need a unix equivilant. Can anyone help? Sample Windows tool that works: AFP To Text Converter 2 2 Download page - AFP To Text Converter Shareware Download ... (5 Replies)
Discussion started by: frustrated1
5 Replies

6. UNIX for Dummies Questions & Answers

Using Shell Script To Loop Program Through Multiple Text Files

Hello, So I have approximately 300 files of raw data (.txt) files that I am using to perform statistical analysis. I have been able to construct a Fortran program that is able to perform my statistical analysis on a file by file basis. However, I now want to be able to loop program through... (19 Replies)
Discussion started by: Jimmyd24
19 Replies

7. Shell Programming and Scripting

Convert directory of text files to Unix/Linux Line Ending

I need help converting a directory of *.txt with Windows line ending to UTF-8 character encoding and Unix/Linux line ending. (9 Replies)
Discussion started by: chipperuga
9 Replies

8. Shell Programming and Scripting

Loop through text file > Copy Folder > Edit XML files in bulk?

I have a text file which contains lines in this format - it contains 105 lines in total, but I'm just putting 4 here to keep it short: 58571,east_ppl_ppla_por 58788,east_pcy_hd_por 58704,east_pcy_ga_por 58697,east_pcy_pcybs_por It's called id_key.txt I have a sample folder called... (9 Replies)
Discussion started by: biscuitcreek
9 Replies

9. Shell Programming and Scripting

sed or awk to convert text files with recurring headings to rows and colum

I have many text file reports generated by a Information Assurance tool that I need to get into a .CSV format or Excel tab delimited format. I want to use sed or awk to grab all the information in the sample text file below and create column headings:Risk ID, Risk Level, Category, Description, How... (5 Replies)
Discussion started by: Bjoeboo
5 Replies

10. UNIX for Dummies Questions & Answers

Print Multipul Fiels as One shot

Hi there This is my first post. I just want to know the best way to print N number of files as one shot. Let's simulate the case ... > ls file1.txt file2.txt file3.txt file4.txt file5.txt What is the best way to print all this files.. what I'm doing now is / > print... (9 Replies)
Discussion started by: geoquest
9 Replies
Login or Register to Ask a Question