How to do I convert the contents to the below format?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
-3
down vote

favorite












pid name tid mod state data
-------------------------------------------------------------------------
39523 srv0051_0001_0 39642 20-10:59:28 Working 820000:500196:500077
43137 srv0051_0005_0 43156 20-10:59:28 Working 820000:4250501:840057
43895 srv0051_0006_0 43903 20-10:59:28 Working 820000:4250501:840057
47523 srv0051_0009_0 47547 20-10:59:28 Working 600005:4250501:4250846
48841 srv0051_0010_0 48851 20-10:59:28 Working 600005:4290000:4290000
58182 srv0051_0020_0 58188 20-10:59:28 Working 820000:4250501:840057
8297 srv0079_0008_0 8316 20-10:59:27 Working 600005:3070001:3050012




pid,name,tid,mod,state,appnbr,request,tasknbr,appctx,username
39523,srv0051_0001_0,39642,09-JUL-2018 12:36:10,Working,820000,500196,500077
43137,srv0051_0005_0,43156,09-JUL-2018 12:36:10,Working,820000,4250501,840057
43895,srv0051_0006_0,43903,09-JUL-2018 12:36:10,Working,820000,4250501,840057
47523,srv0051_0009_0,47547,09-JUL-2018 12:36:10,Working,600005,4250501,4250846
48841,srv0051_0010_0,48851,09-JUL-2018 12:36:10,Working,600005,4290000,4290000
58182,srv0051_0020_0,58188,09-JUL-2018 12:36:10,Working,820000,4250501,840057
8297,srv0079_0008_0,8316,09-JUL-2018 12:36:10,Working,600005,3070001,3050012


This data is being gathered by running the below command:



spsmon -state working -snapshot > /root/file.txt


What I have so far:



awk 'BEGINprint 
"pid,name,tid,mod,state,appnbr,request,tasknbr,appctx,username" NR>5
'!/Process/' '!/ProcessModules/' '!/ProcessEvoke/' print
$1","$2","$3","$4","$5","gensub(/:/,",","g",$6)' /root/file.txt >
/root/file.txt


I'm mainly confused on how to change the mod column into my desire date format.







share|improve this question





















  • what does 20-10:59:28 is meant?
    – SivaPrasath
    Jul 10 at 20:43










  • That's what a call to be in lazy mode...
    – marc
    Jul 10 at 20:45














up vote
-3
down vote

favorite












pid name tid mod state data
-------------------------------------------------------------------------
39523 srv0051_0001_0 39642 20-10:59:28 Working 820000:500196:500077
43137 srv0051_0005_0 43156 20-10:59:28 Working 820000:4250501:840057
43895 srv0051_0006_0 43903 20-10:59:28 Working 820000:4250501:840057
47523 srv0051_0009_0 47547 20-10:59:28 Working 600005:4250501:4250846
48841 srv0051_0010_0 48851 20-10:59:28 Working 600005:4290000:4290000
58182 srv0051_0020_0 58188 20-10:59:28 Working 820000:4250501:840057
8297 srv0079_0008_0 8316 20-10:59:27 Working 600005:3070001:3050012




pid,name,tid,mod,state,appnbr,request,tasknbr,appctx,username
39523,srv0051_0001_0,39642,09-JUL-2018 12:36:10,Working,820000,500196,500077
43137,srv0051_0005_0,43156,09-JUL-2018 12:36:10,Working,820000,4250501,840057
43895,srv0051_0006_0,43903,09-JUL-2018 12:36:10,Working,820000,4250501,840057
47523,srv0051_0009_0,47547,09-JUL-2018 12:36:10,Working,600005,4250501,4250846
48841,srv0051_0010_0,48851,09-JUL-2018 12:36:10,Working,600005,4290000,4290000
58182,srv0051_0020_0,58188,09-JUL-2018 12:36:10,Working,820000,4250501,840057
8297,srv0079_0008_0,8316,09-JUL-2018 12:36:10,Working,600005,3070001,3050012


This data is being gathered by running the below command:



spsmon -state working -snapshot > /root/file.txt


What I have so far:



awk 'BEGINprint 
"pid,name,tid,mod,state,appnbr,request,tasknbr,appctx,username" NR>5
'!/Process/' '!/ProcessModules/' '!/ProcessEvoke/' print
$1","$2","$3","$4","$5","gensub(/:/,",","g",$6)' /root/file.txt >
/root/file.txt


I'm mainly confused on how to change the mod column into my desire date format.







share|improve this question





















  • what does 20-10:59:28 is meant?
    – SivaPrasath
    Jul 10 at 20:43










  • That's what a call to be in lazy mode...
    – marc
    Jul 10 at 20:45












up vote
-3
down vote

favorite









up vote
-3
down vote

favorite











pid name tid mod state data
-------------------------------------------------------------------------
39523 srv0051_0001_0 39642 20-10:59:28 Working 820000:500196:500077
43137 srv0051_0005_0 43156 20-10:59:28 Working 820000:4250501:840057
43895 srv0051_0006_0 43903 20-10:59:28 Working 820000:4250501:840057
47523 srv0051_0009_0 47547 20-10:59:28 Working 600005:4250501:4250846
48841 srv0051_0010_0 48851 20-10:59:28 Working 600005:4290000:4290000
58182 srv0051_0020_0 58188 20-10:59:28 Working 820000:4250501:840057
8297 srv0079_0008_0 8316 20-10:59:27 Working 600005:3070001:3050012




pid,name,tid,mod,state,appnbr,request,tasknbr,appctx,username
39523,srv0051_0001_0,39642,09-JUL-2018 12:36:10,Working,820000,500196,500077
43137,srv0051_0005_0,43156,09-JUL-2018 12:36:10,Working,820000,4250501,840057
43895,srv0051_0006_0,43903,09-JUL-2018 12:36:10,Working,820000,4250501,840057
47523,srv0051_0009_0,47547,09-JUL-2018 12:36:10,Working,600005,4250501,4250846
48841,srv0051_0010_0,48851,09-JUL-2018 12:36:10,Working,600005,4290000,4290000
58182,srv0051_0020_0,58188,09-JUL-2018 12:36:10,Working,820000,4250501,840057
8297,srv0079_0008_0,8316,09-JUL-2018 12:36:10,Working,600005,3070001,3050012


This data is being gathered by running the below command:



spsmon -state working -snapshot > /root/file.txt


What I have so far:



awk 'BEGINprint 
"pid,name,tid,mod,state,appnbr,request,tasknbr,appctx,username" NR>5
'!/Process/' '!/ProcessModules/' '!/ProcessEvoke/' print
$1","$2","$3","$4","$5","gensub(/:/,",","g",$6)' /root/file.txt >
/root/file.txt


I'm mainly confused on how to change the mod column into my desire date format.







share|improve this question













pid name tid mod state data
-------------------------------------------------------------------------
39523 srv0051_0001_0 39642 20-10:59:28 Working 820000:500196:500077
43137 srv0051_0005_0 43156 20-10:59:28 Working 820000:4250501:840057
43895 srv0051_0006_0 43903 20-10:59:28 Working 820000:4250501:840057
47523 srv0051_0009_0 47547 20-10:59:28 Working 600005:4250501:4250846
48841 srv0051_0010_0 48851 20-10:59:28 Working 600005:4290000:4290000
58182 srv0051_0020_0 58188 20-10:59:28 Working 820000:4250501:840057
8297 srv0079_0008_0 8316 20-10:59:27 Working 600005:3070001:3050012




pid,name,tid,mod,state,appnbr,request,tasknbr,appctx,username
39523,srv0051_0001_0,39642,09-JUL-2018 12:36:10,Working,820000,500196,500077
43137,srv0051_0005_0,43156,09-JUL-2018 12:36:10,Working,820000,4250501,840057
43895,srv0051_0006_0,43903,09-JUL-2018 12:36:10,Working,820000,4250501,840057
47523,srv0051_0009_0,47547,09-JUL-2018 12:36:10,Working,600005,4250501,4250846
48841,srv0051_0010_0,48851,09-JUL-2018 12:36:10,Working,600005,4290000,4290000
58182,srv0051_0020_0,58188,09-JUL-2018 12:36:10,Working,820000,4250501,840057
8297,srv0079_0008_0,8316,09-JUL-2018 12:36:10,Working,600005,3070001,3050012


This data is being gathered by running the below command:



spsmon -state working -snapshot > /root/file.txt


What I have so far:



awk 'BEGINprint 
"pid,name,tid,mod,state,appnbr,request,tasknbr,appctx,username" NR>5
'!/Process/' '!/ProcessModules/' '!/ProcessEvoke/' print
$1","$2","$3","$4","$5","gensub(/:/,",","g",$6)' /root/file.txt >
/root/file.txt


I'm mainly confused on how to change the mod column into my desire date format.









share|improve this question












share|improve this question




share|improve this question








edited Jul 10 at 21:22









SivaPrasath

3,68311636




3,68311636









asked Jul 10 at 20:33









fball4life36

347




347











  • what does 20-10:59:28 is meant?
    – SivaPrasath
    Jul 10 at 20:43










  • That's what a call to be in lazy mode...
    – marc
    Jul 10 at 20:45
















  • what does 20-10:59:28 is meant?
    – SivaPrasath
    Jul 10 at 20:43










  • That's what a call to be in lazy mode...
    – marc
    Jul 10 at 20:45















what does 20-10:59:28 is meant?
– SivaPrasath
Jul 10 at 20:43




what does 20-10:59:28 is meant?
– SivaPrasath
Jul 10 at 20:43












That's what a call to be in lazy mode...
– marc
Jul 10 at 20:45




That's what a call to be in lazy mode...
– marc
Jul 10 at 20:45










3 Answers
3






active

oldest

votes

















up vote
4
down vote



accepted










Using GNU Awk, and taking the missing month and year from current time:



gawk '
BEGIN
OFS=","
print "pid,name,tid,mod,state,appnbr,request,tasknbr,appctx,username"

NR>2
split($4,a,"-")
$4 = a[1] strftime("-%^b-%Y ", systime()) a[2]
gsub(/:/,",",$6)
print
' /root/file.txt


or omit the file and use it in a pipe



spsmon -state working -snapshot | gawk '...'



Ex.



$ gawk '
BEGIN
OFS=","
print "pid,name,tid,mod,state,appnbr,request,tasknbr,appctx,username"

NR>2
split($4,a,"-")
$4 = a[1] strftime("-%^b-%Y ", systime()) a[2]
gsub(/:/,",",$6)
print
' file.txt
pid,name,tid,mod,state,appnbr,request,tasknbr,appctx,username
39523,srv0051_0001_0,39642,20-JUL-2018 10:59:28,Working,820000,500196,500077
43137,srv0051_0005_0,43156,20-JUL-2018 10:59:28,Working,820000,4250501,840057
43895,srv0051_0006_0,43903,20-JUL-2018 10:59:28,Working,820000,4250501,840057
47523,srv0051_0009_0,47547,20-JUL-2018 10:59:28,Working,600005,4250501,4250846
48841,srv0051_0010_0,48851,20-JUL-2018 10:59:28,Working,600005,4290000,4290000
58182,srv0051_0020_0,58188,20-JUL-2018 10:59:28,Working,820000,4250501,840057
8297,srv0079_0008_0,8316,20-JUL-2018 10:59:27,Working,600005,3070001,3050012





share|improve this answer






























    up vote
    1
    down vote













    Using sed:



     sed -e 's/ */,/g;s/:/,/g;/^-/d;s/data/appnbr,request,tasknbr,appctx,username/1;s/20-10:59:28/09-JUL-2018 12:36:10/g' /root/file.txt





    share|improve this answer




























      up vote
      0
      down vote













      Given that there is nothing apparent in the source data that seems to be the origin of 09-JUL-2018, I have hardcoded it. That said:



      $ awk -F"[ t]+|[:]" 'BEGIN OFS=","; print "pid,name,tid,mod,state,appnbr,request,tasknbr,appctz,username" NR>2 print $1,$2,$3,"09-JUL-2018",$7, $8, $9, $10' input
      pid,name,tid,mod,state,appnbr,request,tasknbr,appctz,username
      39523,srv0051_0001_0,39642,09-JUL-2018,Working,820000,500196,500077
      43137,srv0051_0005_0,43156,09-JUL-2018,Working,820000,4250501,840057
      43895,srv0051_0006_0,43903,09-JUL-2018,Working,820000,4250501,840057
      47523,srv0051_0009_0,47547,09-JUL-2018,Working,600005,4250501,4250846
      48841,srv0051_0010_0,48851,09-JUL-2018,Working,600005,4290000,4290000
      58182,srv0051_0020_0,58188,09-JUL-2018,Working,820000,4250501,840057
      8297,srv0079_0008_0,8316,09-JUL-2018,Working,600005,3070001,3050012





      share|improve this answer





















      • 12:36:10 is missing and I hope it shouldn't be hardcoded. The question is incomplete.
        – SivaPrasath
        Jul 10 at 21:00










      Your Answer







      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "106"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      convertImagesToLinks: false,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );








       

      draft saved


      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f454565%2fhow-to-do-i-convert-the-contents-to-the-below-format%23new-answer', 'question_page');

      );

      Post as a guest






























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      4
      down vote



      accepted










      Using GNU Awk, and taking the missing month and year from current time:



      gawk '
      BEGIN
      OFS=","
      print "pid,name,tid,mod,state,appnbr,request,tasknbr,appctx,username"

      NR>2
      split($4,a,"-")
      $4 = a[1] strftime("-%^b-%Y ", systime()) a[2]
      gsub(/:/,",",$6)
      print
      ' /root/file.txt


      or omit the file and use it in a pipe



      spsmon -state working -snapshot | gawk '...'



      Ex.



      $ gawk '
      BEGIN
      OFS=","
      print "pid,name,tid,mod,state,appnbr,request,tasknbr,appctx,username"

      NR>2
      split($4,a,"-")
      $4 = a[1] strftime("-%^b-%Y ", systime()) a[2]
      gsub(/:/,",",$6)
      print
      ' file.txt
      pid,name,tid,mod,state,appnbr,request,tasknbr,appctx,username
      39523,srv0051_0001_0,39642,20-JUL-2018 10:59:28,Working,820000,500196,500077
      43137,srv0051_0005_0,43156,20-JUL-2018 10:59:28,Working,820000,4250501,840057
      43895,srv0051_0006_0,43903,20-JUL-2018 10:59:28,Working,820000,4250501,840057
      47523,srv0051_0009_0,47547,20-JUL-2018 10:59:28,Working,600005,4250501,4250846
      48841,srv0051_0010_0,48851,20-JUL-2018 10:59:28,Working,600005,4290000,4290000
      58182,srv0051_0020_0,58188,20-JUL-2018 10:59:28,Working,820000,4250501,840057
      8297,srv0079_0008_0,8316,20-JUL-2018 10:59:27,Working,600005,3070001,3050012





      share|improve this answer



























        up vote
        4
        down vote



        accepted










        Using GNU Awk, and taking the missing month and year from current time:



        gawk '
        BEGIN
        OFS=","
        print "pid,name,tid,mod,state,appnbr,request,tasknbr,appctx,username"

        NR>2
        split($4,a,"-")
        $4 = a[1] strftime("-%^b-%Y ", systime()) a[2]
        gsub(/:/,",",$6)
        print
        ' /root/file.txt


        or omit the file and use it in a pipe



        spsmon -state working -snapshot | gawk '...'



        Ex.



        $ gawk '
        BEGIN
        OFS=","
        print "pid,name,tid,mod,state,appnbr,request,tasknbr,appctx,username"

        NR>2
        split($4,a,"-")
        $4 = a[1] strftime("-%^b-%Y ", systime()) a[2]
        gsub(/:/,",",$6)
        print
        ' file.txt
        pid,name,tid,mod,state,appnbr,request,tasknbr,appctx,username
        39523,srv0051_0001_0,39642,20-JUL-2018 10:59:28,Working,820000,500196,500077
        43137,srv0051_0005_0,43156,20-JUL-2018 10:59:28,Working,820000,4250501,840057
        43895,srv0051_0006_0,43903,20-JUL-2018 10:59:28,Working,820000,4250501,840057
        47523,srv0051_0009_0,47547,20-JUL-2018 10:59:28,Working,600005,4250501,4250846
        48841,srv0051_0010_0,48851,20-JUL-2018 10:59:28,Working,600005,4290000,4290000
        58182,srv0051_0020_0,58188,20-JUL-2018 10:59:28,Working,820000,4250501,840057
        8297,srv0079_0008_0,8316,20-JUL-2018 10:59:27,Working,600005,3070001,3050012





        share|improve this answer

























          up vote
          4
          down vote



          accepted







          up vote
          4
          down vote



          accepted






          Using GNU Awk, and taking the missing month and year from current time:



          gawk '
          BEGIN
          OFS=","
          print "pid,name,tid,mod,state,appnbr,request,tasknbr,appctx,username"

          NR>2
          split($4,a,"-")
          $4 = a[1] strftime("-%^b-%Y ", systime()) a[2]
          gsub(/:/,",",$6)
          print
          ' /root/file.txt


          or omit the file and use it in a pipe



          spsmon -state working -snapshot | gawk '...'



          Ex.



          $ gawk '
          BEGIN
          OFS=","
          print "pid,name,tid,mod,state,appnbr,request,tasknbr,appctx,username"

          NR>2
          split($4,a,"-")
          $4 = a[1] strftime("-%^b-%Y ", systime()) a[2]
          gsub(/:/,",",$6)
          print
          ' file.txt
          pid,name,tid,mod,state,appnbr,request,tasknbr,appctx,username
          39523,srv0051_0001_0,39642,20-JUL-2018 10:59:28,Working,820000,500196,500077
          43137,srv0051_0005_0,43156,20-JUL-2018 10:59:28,Working,820000,4250501,840057
          43895,srv0051_0006_0,43903,20-JUL-2018 10:59:28,Working,820000,4250501,840057
          47523,srv0051_0009_0,47547,20-JUL-2018 10:59:28,Working,600005,4250501,4250846
          48841,srv0051_0010_0,48851,20-JUL-2018 10:59:28,Working,600005,4290000,4290000
          58182,srv0051_0020_0,58188,20-JUL-2018 10:59:28,Working,820000,4250501,840057
          8297,srv0079_0008_0,8316,20-JUL-2018 10:59:27,Working,600005,3070001,3050012





          share|improve this answer















          Using GNU Awk, and taking the missing month and year from current time:



          gawk '
          BEGIN
          OFS=","
          print "pid,name,tid,mod,state,appnbr,request,tasknbr,appctx,username"

          NR>2
          split($4,a,"-")
          $4 = a[1] strftime("-%^b-%Y ", systime()) a[2]
          gsub(/:/,",",$6)
          print
          ' /root/file.txt


          or omit the file and use it in a pipe



          spsmon -state working -snapshot | gawk '...'



          Ex.



          $ gawk '
          BEGIN
          OFS=","
          print "pid,name,tid,mod,state,appnbr,request,tasknbr,appctx,username"

          NR>2
          split($4,a,"-")
          $4 = a[1] strftime("-%^b-%Y ", systime()) a[2]
          gsub(/:/,",",$6)
          print
          ' file.txt
          pid,name,tid,mod,state,appnbr,request,tasknbr,appctx,username
          39523,srv0051_0001_0,39642,20-JUL-2018 10:59:28,Working,820000,500196,500077
          43137,srv0051_0005_0,43156,20-JUL-2018 10:59:28,Working,820000,4250501,840057
          43895,srv0051_0006_0,43903,20-JUL-2018 10:59:28,Working,820000,4250501,840057
          47523,srv0051_0009_0,47547,20-JUL-2018 10:59:28,Working,600005,4250501,4250846
          48841,srv0051_0010_0,48851,20-JUL-2018 10:59:28,Working,600005,4290000,4290000
          58182,srv0051_0020_0,58188,20-JUL-2018 10:59:28,Working,820000,4250501,840057
          8297,srv0079_0008_0,8316,20-JUL-2018 10:59:27,Working,600005,3070001,3050012






          share|improve this answer















          share|improve this answer



          share|improve this answer








          edited Jul 10 at 21:33


























          answered Jul 10 at 21:27









          steeldriver

          30.9k34877




          30.9k34877






















              up vote
              1
              down vote













              Using sed:



               sed -e 's/ */,/g;s/:/,/g;/^-/d;s/data/appnbr,request,tasknbr,appctx,username/1;s/20-10:59:28/09-JUL-2018 12:36:10/g' /root/file.txt





              share|improve this answer

























                up vote
                1
                down vote













                Using sed:



                 sed -e 's/ */,/g;s/:/,/g;/^-/d;s/data/appnbr,request,tasknbr,appctx,username/1;s/20-10:59:28/09-JUL-2018 12:36:10/g' /root/file.txt





                share|improve this answer























                  up vote
                  1
                  down vote










                  up vote
                  1
                  down vote









                  Using sed:



                   sed -e 's/ */,/g;s/:/,/g;/^-/d;s/data/appnbr,request,tasknbr,appctx,username/1;s/20-10:59:28/09-JUL-2018 12:36:10/g' /root/file.txt





                  share|improve this answer













                  Using sed:



                   sed -e 's/ */,/g;s/:/,/g;/^-/d;s/data/appnbr,request,tasknbr,appctx,username/1;s/20-10:59:28/09-JUL-2018 12:36:10/g' /root/file.txt






                  share|improve this answer













                  share|improve this answer



                  share|improve this answer











                  answered Jul 10 at 21:23









                  SivaPrasath

                  3,68311636




                  3,68311636




















                      up vote
                      0
                      down vote













                      Given that there is nothing apparent in the source data that seems to be the origin of 09-JUL-2018, I have hardcoded it. That said:



                      $ awk -F"[ t]+|[:]" 'BEGIN OFS=","; print "pid,name,tid,mod,state,appnbr,request,tasknbr,appctz,username" NR>2 print $1,$2,$3,"09-JUL-2018",$7, $8, $9, $10' input
                      pid,name,tid,mod,state,appnbr,request,tasknbr,appctz,username
                      39523,srv0051_0001_0,39642,09-JUL-2018,Working,820000,500196,500077
                      43137,srv0051_0005_0,43156,09-JUL-2018,Working,820000,4250501,840057
                      43895,srv0051_0006_0,43903,09-JUL-2018,Working,820000,4250501,840057
                      47523,srv0051_0009_0,47547,09-JUL-2018,Working,600005,4250501,4250846
                      48841,srv0051_0010_0,48851,09-JUL-2018,Working,600005,4290000,4290000
                      58182,srv0051_0020_0,58188,09-JUL-2018,Working,820000,4250501,840057
                      8297,srv0079_0008_0,8316,09-JUL-2018,Working,600005,3070001,3050012





                      share|improve this answer





















                      • 12:36:10 is missing and I hope it shouldn't be hardcoded. The question is incomplete.
                        – SivaPrasath
                        Jul 10 at 21:00














                      up vote
                      0
                      down vote













                      Given that there is nothing apparent in the source data that seems to be the origin of 09-JUL-2018, I have hardcoded it. That said:



                      $ awk -F"[ t]+|[:]" 'BEGIN OFS=","; print "pid,name,tid,mod,state,appnbr,request,tasknbr,appctz,username" NR>2 print $1,$2,$3,"09-JUL-2018",$7, $8, $9, $10' input
                      pid,name,tid,mod,state,appnbr,request,tasknbr,appctz,username
                      39523,srv0051_0001_0,39642,09-JUL-2018,Working,820000,500196,500077
                      43137,srv0051_0005_0,43156,09-JUL-2018,Working,820000,4250501,840057
                      43895,srv0051_0006_0,43903,09-JUL-2018,Working,820000,4250501,840057
                      47523,srv0051_0009_0,47547,09-JUL-2018,Working,600005,4250501,4250846
                      48841,srv0051_0010_0,48851,09-JUL-2018,Working,600005,4290000,4290000
                      58182,srv0051_0020_0,58188,09-JUL-2018,Working,820000,4250501,840057
                      8297,srv0079_0008_0,8316,09-JUL-2018,Working,600005,3070001,3050012





                      share|improve this answer





















                      • 12:36:10 is missing and I hope it shouldn't be hardcoded. The question is incomplete.
                        – SivaPrasath
                        Jul 10 at 21:00












                      up vote
                      0
                      down vote










                      up vote
                      0
                      down vote









                      Given that there is nothing apparent in the source data that seems to be the origin of 09-JUL-2018, I have hardcoded it. That said:



                      $ awk -F"[ t]+|[:]" 'BEGIN OFS=","; print "pid,name,tid,mod,state,appnbr,request,tasknbr,appctz,username" NR>2 print $1,$2,$3,"09-JUL-2018",$7, $8, $9, $10' input
                      pid,name,tid,mod,state,appnbr,request,tasknbr,appctz,username
                      39523,srv0051_0001_0,39642,09-JUL-2018,Working,820000,500196,500077
                      43137,srv0051_0005_0,43156,09-JUL-2018,Working,820000,4250501,840057
                      43895,srv0051_0006_0,43903,09-JUL-2018,Working,820000,4250501,840057
                      47523,srv0051_0009_0,47547,09-JUL-2018,Working,600005,4250501,4250846
                      48841,srv0051_0010_0,48851,09-JUL-2018,Working,600005,4290000,4290000
                      58182,srv0051_0020_0,58188,09-JUL-2018,Working,820000,4250501,840057
                      8297,srv0079_0008_0,8316,09-JUL-2018,Working,600005,3070001,3050012





                      share|improve this answer













                      Given that there is nothing apparent in the source data that seems to be the origin of 09-JUL-2018, I have hardcoded it. That said:



                      $ awk -F"[ t]+|[:]" 'BEGIN OFS=","; print "pid,name,tid,mod,state,appnbr,request,tasknbr,appctz,username" NR>2 print $1,$2,$3,"09-JUL-2018",$7, $8, $9, $10' input
                      pid,name,tid,mod,state,appnbr,request,tasknbr,appctz,username
                      39523,srv0051_0001_0,39642,09-JUL-2018,Working,820000,500196,500077
                      43137,srv0051_0005_0,43156,09-JUL-2018,Working,820000,4250501,840057
                      43895,srv0051_0006_0,43903,09-JUL-2018,Working,820000,4250501,840057
                      47523,srv0051_0009_0,47547,09-JUL-2018,Working,600005,4250501,4250846
                      48841,srv0051_0010_0,48851,09-JUL-2018,Working,600005,4290000,4290000
                      58182,srv0051_0020_0,58188,09-JUL-2018,Working,820000,4250501,840057
                      8297,srv0079_0008_0,8316,09-JUL-2018,Working,600005,3070001,3050012






                      share|improve this answer













                      share|improve this answer



                      share|improve this answer











                      answered Jul 10 at 20:55









                      DopeGhoti

                      39.7k54779




                      39.7k54779











                      • 12:36:10 is missing and I hope it shouldn't be hardcoded. The question is incomplete.
                        – SivaPrasath
                        Jul 10 at 21:00
















                      • 12:36:10 is missing and I hope it shouldn't be hardcoded. The question is incomplete.
                        – SivaPrasath
                        Jul 10 at 21:00















                      12:36:10 is missing and I hope it shouldn't be hardcoded. The question is incomplete.
                      – SivaPrasath
                      Jul 10 at 21:00




                      12:36:10 is missing and I hope it shouldn't be hardcoded. The question is incomplete.
                      – SivaPrasath
                      Jul 10 at 21:00












                       

                      draft saved


                      draft discarded


























                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f454565%2fhow-to-do-i-convert-the-contents-to-the-below-format%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Popular posts from this blog

                      How to check contact read email or not when send email to Individual?

                      Christian Cage

                      How to properly install USB display driver for Fresco Logic FL2000DX on Ubuntu?