[code] Automatic File Input


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting [code] Automatic File Input
# 1  
Old 11-25-2009
[code] Automatic File Input

i have got many files like this in my folder temp(say)
imp_02042008.txt for date 02-04-2008
imp_03092009.txt for date 03-09-2009
imp_25112009.txt for date 25-11-2009
...................
........

in some folder.
and one of my shell code uses one of the above files based on date.
for example for todays date it should pick the file imp_25112009.txt
for tomorrows date it should pick the file like imp_26112009.txt

My code is like below one:
print substr($1,4,3),"",substr($2,22,8) inputfile.txt>outputfile.txt

This code should run on day to day basis.
What i want is a code to pick up the file (eg..imp_26112009.txt) automatically from folder temp based on day.. i.e, for a given day particular file should be taken as input in my code...
pls help me in this regard..


thread closed.

Continue here: https://www.unix.com/shell-programmin...nput-code.html

Last edited by Neo; 11-25-2009 at 09:04 AM.. Reason: duplicate thread https://www.unix.com/shell-programming-scripting/124568-automatic-file-input-code.html
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Help with the code to do automatic task in plink

Hi, I am newbie tothis forum and also to unix. i wa shownt help in giving me a acceptable code so that i could add it as batch to be included in the task scheduler. i use plink and putty to login to my router. With this i get to the $, linux prompt there i have to issue a command show... (5 Replies)
Discussion started by: jraju
5 Replies

2. Shell Programming and Scripting

Automatic input "yes" in a shell script

Hi All, I need a favour. I have a file called "redhat_servers.txt" containing some server names line by line. When I try to ssh to each server, and I have already done with ssh key-gen stuff. Now, for first time if I do ssh .. I need to type yes I have more than 400 servers...it will take... (4 Replies)
Discussion started by: kumar85shiv
4 Replies

3. UNIX for Dummies Questions & Answers

[Solved] How to refer to input file in code?

This may be a dumb question, but googling is not giving me an answer. I'm trying to figure out how to refer to an input file in my code. Lets say i run a script in bash: "sh shellscript.sh inputfile" (Inputfile will be variable...whatever file i run the script on) I wanted to make... (5 Replies)
Discussion started by: legato22
5 Replies

4. Shell Programming and Scripting

[KSH] Creating automatic variable from read input

Hello there, I am posting to seek help with a KSH script, I am making a simple calculation program where the user can enter as many numbers as they like, I am getting their input using the read command, however I am not sure how to repeat doing this and storing the input in to new variables... (7 Replies)
Discussion started by: pandapowerbox
7 Replies

5. Shell Programming and Scripting

Automatic Input to a command

Hi, I have an issue where i run an command in a shell script. command >/dev/null ret=$? echo ret If the command returns an error i'm redirecting it to /dev/null. The prob is if an error comes it expects the user to press return to continue. And hence the return is not echoed. and the end... (4 Replies)
Discussion started by: subhrap.das
4 Replies

6. Shell Programming and Scripting

Giving automatic multiple Input to a tool from shell script

Hi, Please help me,its urgent. I have a tool that i want to run from a shell script. When we run the tool it will ask the user choice to add or delete. When user enter the choice it will then ask how many units he want to delete or add and will add or delete accordingly. Now I want to... (1 Reply)
Discussion started by: saket18@ymail.c
1 Replies

7. UNIX for Dummies Questions & Answers

12. If an ‘88’ Record with BAI Code ‘902’ was found on input file and not written to Output file, re

This is my input file like this 03,105581,,015,+00000416418,,,901,+00000000148,,,922,+00000000354,,/ 49,+00000000000416920,00002/ 03,5313236,,015,+00231036992,,,045,+00231036992,,,901,+00000048428,,/ 88,100,+0000000000000,0000000,,400,+0000000000000,0000000,/ 88,902,+0000000079077,,/... (0 Replies)
Discussion started by: sgoud
0 Replies

8. Shell Programming and Scripting

Help to write a script or program to automatic execute and link input file data

Output file template format <input_file_name>a</input_file_name> <total_length_size>b</total_length_size> <log_10_length_size>c</log_10_length_size> Input_file_1 (eg. sample.txt) SDFSDGDGSFGRTREREYWW Parameter: a is equal to the input file name b is equal to the total length of... (2 Replies)
Discussion started by: perl_beginner
2 Replies

9. Shell Programming and Scripting

Automatic file input to code

i have got many files like this in my folder temp(say) imp_02042008.txt for date 02-04-2008 imp_03092009.txt for date 03-09-2009 imp_25112009.txt for date 25-11-2009 ................... ........ in some folder. and one of my shell code uses one of the above files based on date.... (9 Replies)
Discussion started by: Maruti
9 Replies

10. UNIX for Advanced & Expert Users

Automatic input to commands

Hi, In a shell script i am running a command which is asking for input. How can i give that automatically. I have done this before but for the time being can't recall. Was something like <| Thanks (6 Replies)
Discussion started by: vibhor_agarwali
6 Replies
Login or Register to Ask a Question