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.
call file dynamically
Name: navin Date: September 2, 2003 at 14:23:41 Pacific OS: solaris CPU/Ram: 256
Comment:
I have a job that needs to run daily. I need to write a shell script which will pick up a input file that is generated daily. The generated file is going to have the jobname with sysdate and some more characters appended to it. In this, jobname is going to remain same, the syadate will change daily and the last few characters will be generated daily automatically.
e.g. the name of the file will be : on 26 th - abc20030826123 on 27 th - abc20030827234 on 28 th - abc20030828568
Name: LANkrypt0 Date: September 3, 2003 at 05:37:01 Pacific
Reply:
This actually should not be that hard, you have known portions of the file, the abcYYYMMDD part, so you could easily search for that, and it would be unique as only one file is generated that day.
I simply used: #!/bin/ksh getfile=$(ls | grep abc$(date +"%Y%m%d")) $getfile
That did a list of files, grep'd for the date in the specific abcYYYYMMDD format as that is not changing, and produced one file.
Summary: datevar=$(date '+%m%y') var=somevariable con=someconstant filename=${var}${con}${datevar}.app To get the filename into each row loaded, maybe you could preprocess the data file with sed. Or, use sed e...
Summary: Does anyone know how to do string manipulation to remove the first 'n' characters?? For example, I have a file called file.txt...The contents of file.txt is this the string "0x8000000"... How could I ...
Summary: Hello, From the varients of unix I use there is a command called file. If you run this against the core file then it should give you the failing command. eg. file core.1234 core.4036: ELF 32-bit ...