Find the answer to your Linux question:
Page 2 of 2 FirstFirst 1 2
Results 11 to 13 of 13
Almost there lol... Last question and Ill be done Code: awk '{ NF==12? a="6 7 8 10":a="5 6 7 9"; n=split(a,A," "); printf tolower($1":"); for(i=l;i<=n;i++){printf ("%s", tolower(substr($A[i],1,1)))} print substr($NF,9,4) }' ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #11
    Just Joined!
    Join Date
    Apr 2012
    Posts
    15

    Almost there lol... Last question and Ill be done

    Code:
    awk '{
       NF==12? a="6 7 8 10":a="5 6 7 9";
       n=split(a,A," "); 
       printf tolower($1":"); 
       for(i=l;i<=n;i++){printf ("%s", tolower(substr($A[i],1,1)))} 
       print substr($NF,9,4)
     }' $1
    Gives me this output:
    jcc2380:jjbci9445
    jac1936:jsbci7993
    acc4636:ajbcc0437
    spf1696:sjbcc2398

    This is the output i need:
    jcc2380:jbci9445
    jac1936:sbci7993
    acc4636:jbcc0437
    spf1696:jbcc2398

    I need the ninth character to not be there. Simple cut command ?

  2. #12
    Linux Newbie
    Join Date
    Nov 2012
    Posts
    237
    Quote Originally Posted by whatcouldhappen View Post
    This is the output i need:
    jcc2380:jbci9445
    jac1936:sbci7993
    acc4636:jbcc0437
    spf1696:jbcc2398

    I need the ninth character to not be there. Simple cut command ?
    this is what I get.
    Code:
    $ cat $file
    JCC2380 XXX-XX-XXXX CAREY, JULIE C JR-II BISS CPSC BS INFO TECH 412/779-9445
    JAC1936 XXX-XX-XXXX CONSOLMAGNO, JOE A. SO-I BISS CPSC BS INFO TECH 412/833-7993
    ACC4636 XXX-XX-XXXX CURRIE, ADAM C. JR-II BISS CPSC BS COMP SCI 724/657-0437
    SPF1696 XXX-XX-XXXX FARLEY, SEAN P. JR-I BISS CPSC BS COMP SCI 814/236-2398
    SEK8835 XXX-XX-XXXX KELLEY, SHAWN E. FR-II BISS CPSC BS COMP SCI 724/406-7149
    MCK0599 XXX-XX-XXXX KOMISIN, MICHAEL C. JR-I BISS CPSC BS COMP SCI 000/000-0000
    GJM1887 XXX-XX-XXXX MACK, GREGORY J. SO-II BISS CPSC BS INFO TECH 724/735-4354
    NGM5479 XXX-XX-XXXX MCINTIRE, NICHOLAS G JR-I BISS CPSC BS INFO TECH 724/794-8268
    ZTP7190 XXX-XX-XXXX PETAK, ZACHARY T. FR-II BISS CPSC BS INFO TECH 724/406-1298
    AXS9097 XXX-XX-XXXX SAUNDERS, ALEXANDER SO-I BISS CPSC BS INFO TECH 724/334-0313
    RJS6624 XXX-XX-XXXX SNYDER, ROBERT J. SO-II BISS CPSC BS COMP SCI 814/328-2021
    MWS1990 XXX-XX-XXXX STASNY, MATTHEW W SO-II BISS CPSC BS INFO TECH 412/882-0581
    $ awk '{ NF==12?a="6 7 8 10":a="5 6 7 9"; n=split(a,A," "); printf(tolower($1":")); for(i=1;i<=n;i++){printf("%s", tolower(substr($A[i],1,1)))} print substr($NF,9,4)}' $file
    jcc2380:jbci9445
    jac1936:sbci7993
    acc4636:jbcc0437
    spf1696:jbcc2398
    sek8835:fbcc7149
    mck0599:jbcc0000
    gjm1887:sbci4354
    ngm5479:jbci8268
    ztp7190:fbci1298
    axs9097:sbci0313
    rjs6624:sbcc2021
    mws1990:sbci0581
    did your file change?

  3. #13
    Just Joined!
    Join Date
    Apr 2012
    Posts
    15
    ok nvm sorry. But the help is very much appreciated

  4. $spacer_open
    $spacer_close
Page 2 of 2 FirstFirst 1 2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •