0

A proprietary command similar to "df" returns me this :

FOO_vol6        1714236984   1685700840     28536144   98%    /root_vdm_10/FOO_vol6
FOO_vol4         253851840     64818424    189033416   26%    /root_vdm_10/FOO_vol4
FOO_vol0         827269560    404664536    422605024   49%    /root_vdm_10/FOO_vol0
FOO_vol1        2085318984   1318369688    766949296   63%    /root_vdm_10/FOO_vol1
FOO_vol3        5449936112   4883375096    566561016   90%    /root_vdm_10/FOO_vol3
fs_foobar_users
                7021452248   6879023968    142428280   98%    /root_vdm_6/users
fs_bar_foobarsources
                1280329688   1241297032     39032656   97%    /root_vdm_6/foobarsources
fs_foo_datas2  1858572248   1646175040    212397208   89%    /root_vdm_4/DATAS2

As you can see, if the column 1 lengh < ~ 15 characters, the numbers are on the same line, if not, they are on a second line. I would like to have everything on the single line to process those data.

I need (perhaps with sed ou awk ?) to code something like : - if there is only one column, then, remove the carriage return - or, if the first word of the list if larger then ~ 16 characters, then remove carriage return.

0

you may do this:

$ your_df_cmd_here | sed -e '/\s/!N;s/\n\s*/ /'
1
  • WOW, it works, thanks a LOT !
    – LMJ
    May 22 '19 at 8:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.