AWK SED Manipulate text to sort it as CSV -
i have input file
shared folder: \\serverc1\"uh4" share name \\serverc1\uh4 path c:\vol\cn_fs4\cn_qt01\fileserver43\userhome remark maximum users no limit users 0 permissions: windom\nascifsmig01: total command windom\adminda14b : total command windom\adminda16 : total command command completed successfully. ============================================================================================================ shared folder: \\serverc1\"uh5" share name \\serverc1\uh5 path c:\vol\cn_fs2\cn_qt01\fileserver01\userhome remark maximum users no limit users 0 permissions: windom\nascifsmig01: total command windom\adminda14b : total command windom\adminda20 : total command command completed successfully. ============================================================================================================
i need output :
\\serverc1\uh4;c:\vol\cn_fs4\cn_qt01\fileserver43\userhome;windom\nascifsmig01: total control;windom\adminda14b : total control;windom\adminda16 : total command \\serverc1\uh5;c:\vol\cn_fs2\cn_qt01\fileserver01\userhome;windom\nascifsmig01: total control;windom\adminda14b : total control;windom\adminda20 : total command
do have suggestion? have no thought how it. tried do: sed -n "/permissions:/,/the command completed succesfully/p" permissions doesn't work.
sed -ne 's/^share name *(\\\\.*)/\1;/p;s/^path *(.*)$/\1;/p;s/^windom.*/&;/p' input.txt | tr -d "\n" | sed 's/;\\\\/;\n\\\\/g' | sed 's/;$//'
output:
\\serverc1\uh4;c:\vol\cn_fs4\cn_qt01\fileserver43\userhome;windom\nascifsmig01: total control;windom\adminda14b : total control;windom\adminda16 : total command \\serverc1\uh5;c:\vol\cn_fs2\cn_qt01\fileserver01\userhome;windom\nascifsmig01: total control;windom\adminda14b : total control;windom\adminda20 : total command csv text awk sed
No comments:
Post a Comment