I think Don's script has found a bug in your, what looks like a, perl script; wherever that came from!?
I could be wrong but it looks as though your script cannot differentiate between 0, (zero) as a number and 0, (zero) as a file...
-g 0
Did you test your _perl_ script with a file named "0"?
Just a thought, as Don's script looks as though it generates a file name "0".
Hi zajtat,
Yes, the first invocation of combining.executable:
creates a file named 0 and the second invocation of combining.executable:
uses file 0 and creates file 1. Subsequent passes through the loop alternate between creating file 0 and using file 1 on odd numbered invocations (after invocation 1) and creating file 1 and using file 0 on even numbered invocations.
And, on OS X, the script I suggested works with both bash (version: GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin15)) and with ksh producing the output you said you wanted with the three input files you provided as samples in post #1 in this thread (except the order of the 1st two lines in the output was switched) with combining.executable being the script:
which works fine as long as the input files are text files. Note that with the number of files you are combining, the above script might or might not work. The awk utility is only required to work on text files and some of the files this script will be processing will not be text files (due to excessive line lengths).
If your perl script won't accept 0 as a filename, that is your problem. The script I provided (after changing the 1st line to use your shell) meets all of your specifications.
If you would like to give us a clear specification of the allowed filenames for the -g option to your perl script, I might be able to help you make the script I suggested use different temporary filenames.
This site has been very helpful thus far.. I thank you all in advance for sharing the knowledge. Let me get to it.
I am trying to write a very small script to take away from the boredom of doing the same thing over and over.
Everynow and again I have to get the hex value of a file using a... (2 Replies)
Hi,
I am having an Input file .which is having a list of names.
comapring with our database , needs to write the out put in file called output.txt , format should be name--> country--->phone number
could you please help me..
thanks in advance (7 Replies)
Hi there
could anybody point me in the right direction when it comes to looping through the output of a system command in perl (i.e. df -k) doing a test against each line to see if it matches?
for example if i have a df -k output like this and I wanted to grab the lines that matched "sda" or... (3 Replies)
Hi,
I have two files , one file with data file with attributes that need to be sent to another file to generate a predefined format.
Example:
File.txt
AP|{SSHA}VEEg42CNCghUnGhCVg==
APVG3|{SSHA}XK|"password"
AP3|{SSHA}XK|"This is test"
....
etc
---------
test.sh has... (1 Reply)
Hi friends,
I'm newbie to SVM.
Just wanna try installed it on one of our server (to do mirroring for disk0 and disk1) but i think im lost until now. :(
the steps i've taken is as below:-
1.prtvtoc /dev/rdsk/c1t0d0s2 | fmthard -s - /dev/rdsk/c1t1d0s2
2.metadb -a -c 3 -f c1t0d0s7... (3 Replies)
Legends,
I want to remain in the script until user passes the correct name.
I had tried the below code; but it didn't work out.
Please help
echo "\nPlease enter the source system: \c"
while read SYSTEM_NAME
do
if ];
then
echo "\nMaking $SYSTEM_NAME as source system for particular... (5 Replies)
I have been trying this program for a long time. I am trying to read a file named "odon" line by line; read the first line, send it to do a command saved in a file "perm", once the first line has finished going through the content of the file perm, the result is saved with the number of the line.... (17 Replies)
Hi all,
I am trying to loop through the string contents of an array, to add it during the saving of the output files. I am trying this code to print each column and save it to unique file name, but it doesn't work. Thanks for any help.
fnam=(japan usa uk)
alldata.dat contained sample data... (1 Reply)
Hi,
I have some output from 'ls' command and I want to loop over the output in a bash script. What would be a good way to go about it?
For example, if the output of the ls command gives me 'prefix1 prefix2 prefix3', how can I set a loop that will iterate over these?
many thanks! (5 Replies)