by Dieter Kraft <kraft@[EMAIL PROTECTED]
>
Mar 25, 2008 at 09:48 PM
pk wrote:
> Dieter Kraft wrote:
>
>> Hi,
>>
>> I have a shell script
>> with (1000) contiguous textlines like
>>
>> ampl Models/aircrftb.mod > Output/aircrftb.out
>> ampl Models/air****t.mod > Output/air****t.out
>> ampl Models/aljazzaf.mod > Output/aljazzaf.out
>> ampl Models/allinitc.mod > Output/allinitc.out
>> ampl Models/allinit.mod > Output/allinit.out
>> ampl Models/allinitu.mod > Output/allinitu.out
>> ampl Models/alsotame.mod > Output/alsotame.out
>>
>> before each line I want to insert a new line to print
>> the model name into a TeX file, like
>>
>> printf '%s' " aircrftb & " >> TABLE.TEX
>> and
>> printf '%s' " air****t & " >> TABLE.TEX
>> etc.
>>
>> How can I do this in sed or awk?
>
> (assuming the .mod and the .out name are always the same)
>
> awk -v sq="'" -v dq='"' -F '[/.]' '{
> print "printf "sq"%s"sq" "dq" "$(NF-1)" & "dq" >> TABLE.TEX";
> print}' yourscript.sh
>
Thanks a lot; it's exactly what I need, but it is cryptic for me.
If you have some time could you explain roughly what you did.
Dieter
--
Dieter Kraft
Munich University of Applied Sciences
Department of Mechanical Engineering
dieter.kraft@[EMAIL PROTECTED]