in reply to modifying script to ask for file name as input
Is it possible to modify this script to ask for input ...Yes
But I think the better question is:
Is it possible to rewrite this script to simplify my life?The answer to which is also Yes.
Here's your problem, as I see it:
And you're ready to go. Note that awk counts fields starting at 1, and Perl arrays start from 0.open GRAPHIN, '>', 'data-in' or die "Can't open data-in: $!\n"; open GRAPHOUT, '>', data-out' or die "Can't open data-out: $!\n"; while (<>) # You can pass the input file name on the command line { my @f = split /\s/; # Like awk: split at white space print GRAPHIN $f[0], ' ', $f[3], "\n"; print GRAPHOUT $f[0], ' ', $f[4], "\n"; } close GRAPHIN; # Could live without these close GRAPHOUT; system './graph'; # Execute your graph program
This is not tested code, it's a guess at what you're trying to do. Unfortunately, my ESP is a little rusty, so I may have misread what you're trying to do. In any case, HTH.
|
|---|