Hi bartus11,
Thanks for your response and help.
First of all, I've tried to put your first script into the command line and put "\" when needed enter. However, there are some errors as shwon below.
# awk 'BEGIN{"awk '{$3=$3\" \"$4;$4=$5\" \"$6;$5=$7\" \"$8;$6=$9;\
> for (i=1;i<=NF-3;i++) if (max<=length($i)) max=length($i)}\
sh: Syntax error: `(' is not expected.
Could not figure out what is missing, hence unable to proceed.
Please kindly advice. Thanks
Regards,
Peter
---------- Post updated at 10:07 PM ---------- Previous update was at 08:23 PM ----------
Hi drl,
Thanks for your response.
I�ve downloaded and reviewed the align program from the website.
However, I would prefer to use a script that is easier to manage.
No offence. Thanks.
Regards,
Peter
---------- Post updated 06-24-10 at 12:40 AM ---------- Previous update was 06-23-10 at 10:07 PM ----------
Hi bartus11,
I�ve tested your second script, but after a few trying, I�m still unable to get it working.
Please see below for its error message.
# awk -f script.awk OUTPUT2
awk: The string awk '{$3=$ cannot contain a newline character.
The source line is 12.
The error context is
BEGIN{"awk '{$3=$3\" \"$4;$4=$5\" \"$6;$5=$7\" \"$8;$6=$9; >>>
<<<
syntax error The source line is 14.
awk: The statement cannot be correctly parsed.
The source line is 14.
Executed by using:
awk -f script.awk OUTPUT2
Seems like there is syntax error in the script.
Also, how would I be able to incorporate this script into my existing script rather than having another set of script?
Appreciate for any of your help and advice.
Thanks.
PS:
FYI, I�m using HPUX B.11.23 U ia64.
Regards,
Peter
---------- Post updated at 04:46 AM ---------- Previous update was at 01:47 AM ----------
Hi Gurus,
After much of trying, I manage to sort of getting the desired output.
Sample data:
/dev/vg00/lvol5 /home 0.12 GB 0.02 GB 0.10 GB 19%
/dev/vg00/misc /misc 28.43 GB 4.92 GB 23.51 GB 17%
/dev/vg00/lvol6 /opt 8.25 GB 5.43 GB 2.82 GB 65%
/dev/vgsap/ora10264 /oracle/TES/102_64 9.89 GB 8.37 GB 1.52 GB 84%
/dev/vgsap/mirra /oracle/TES/mirrlogA 0.48 GB 0.26 GB 0.21 GB 54%
/dev/vgsap/sapdata1 /oracle/TES/sapdata1 228.90 GB 89.47 GB 139.42 GB 39%
Script executed:
awk '{printf "%-22s %-23s %-1s %-8s %-1s %-8s %-1s %-8s %-1s %-8s\n", $1, $2, $3, $4, $5, $6, $7, $8, $9, $10}' TEST_DATA
Output:
/dev/vg00/lvol5 /home 0.12 GB 0.02 GB 0.10 GB 19%
/dev/vg00/misc /misc 28.43 GB 4.92 GB 23.51 GB 17%
/dev/vg00/lvol6 /opt 8.25 GB 5.43 GB 2.82 GB 65%
/dev/vgsap/ora10264 /oracle/TES/102_64 9.89 GB 8.37 GB 1.52 GB 84%
/dev/vgsap/mirra /oracle/TES/mirrlogA 0.48 GB 0.26 GB 0.21 GB 54%
/dev/vgsap/sapdata1 /oracle/TES/sapdata1 228.90 GB 89.47 GB 139.42 GB 39%
As shown above, the alignment is almost there, but there are still some issue from 4th column onwards.
Anybody can help and advice on how to solve this issue?
Thanks a lot.
Regards,
Peter