awk cuts stdout to 80 characters ? 
Author Message
 awk cuts stdout to 80 characters ?

I have a gawk script invoked by a crontab (under DU 3.2) which contains
the following two lines, i.e. it executes a "ps" command saving its
output to a file

cmd="ps -A -o ppid,pid,user,tname,ucomm,cputime,start,state,command | \
     tail +2 | sort"

u=system(cmd ">" fil2)

The output of the ps command can be quite wide (i.e. some of the lines
can be very long).

When I execute the ps ... > file in the shell, or when I execute the awk
script from the shell (my interactive shell), the file is fine. However
when I run it from crontab the file lines are truncated to 80
characters.

How can I get the lines in their full length ?

--
----------------------------------------------------------------------

avoid unwanted spam. Any mail returning to this address will be rejected.
Users can disclose their e-mail address in the article if they wish so.



Sat, 23 Oct 2004 22:52:19 GMT  
 awk cuts stdout to 80 characters ?

Quote:
>I have a gawk script invoked by a crontab (under DU 3.2) which contains
>the following two lines, i.e. it executes a "ps" command saving its
>output to a file

>cmd="ps -A -o ppid,pid,user,tname,ucomm,cputime,start,state,command | \
>     tail +2 | sort"

>u=system(cmd ">" fil2)

>The output of the ps command can be quite wide (i.e. some of the lines
>can be very long).

>When I execute the ps ... > file in the shell, or when I execute the awk
>script from the shell (my interactive shell), the file is fine. However
>when I run it from crontab the file lines are truncated to 80
>characters.

>How can I get the lines in their full length ?

Try setting COLUMNS to a big value for the environment of 'ps'
using the 'env' command;

cmd="env COLUMNS=999 ps -A -o ppid,pid,user,tname,ucomm,cputime,start,state,command | \
     tail +2 | sort"

byefrom

--

                # if you are bored crack my sig.
1F8B0808CABB793C0000666667002D8E410E83300C04EF91F2877D00CA138A7A
EAA98F30C494480157B623C4EF1B508FDED1CEFA9152A23DE35D661593C5318E
630C313CD701BE92E390563326EE17A3CA818F5266E4C2461547F1F5267659CA
8EE2092F76C329ED02CA430C5373CC62FF94BAC6210B36D9F9BC4AB53378D978
80F2978A1A6E5D6F5133B67B6113178DC1059526698AFE5C17A5187E7D930492



Mon, 25 Oct 2004 07:05:35 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. CHARACTER*1 A(80) and CHARACTER*80 A?

2. character*80 versus character*1 (80)

3. Turbo Modula-2 for Z-80 CP/M-80

4. ST-80/OS/2 vs. ST-80/Windows

5. Resize ST-80 Browser Panes (was Cognitive Overload with ST-80)

6. Exchange ST-80/Win v2.5 for ST-80/OS2 v2.5

7. Help needed: communication Mac Sm-80 with Sun, graphics in Sm-80

8. a short cut related question in awk

9. awk-equivalent to e.g. cut -f5-

10. scripts: ksh calls awk: no stdout?

11. To cut or not to cut?

12. Protecting special awk characters

 

 
Powered by phpBB® Forum Software