I have a list which is an output from a media program actually and i want to remove all the junk so i can use that list to my Zenity script but involves alot of sed commands in one string which is the way i prefer im open any suggestion that involves only sed.
I will explain exactly what i'm trying to succeed:
The actual list is List.txt: The * is just hex 1b
*line here is not needed*
*[1m0 *[22m : *[35mThis has SPACES inside, Must be DOTS!*[39m : *[34m123.123ABCD*[39m
*[1m1 *[22m : *[35mThis-DONT-have(SPACES)-inside*[39m : *[34m900.578CD*[39m
*[1m2 *[22m : *[35mThis SPACE!!! inside, # Must be DOTS!*[39m : *[34m9K99123AD*[39m
*[1m3 *[22m : *[35mSPACES *Must* be DOTS!*[39m : *[34mAB*[39m
*[1m4 *[22m : *[35mMust[be] [DOTS] !*[39m : *[34m12.AZZZ*[39m
*[1m5 *[22m : *[35mSPACES ~DOTS!*[39m : *[34m654KK45*[39m
This is my sed equation:
cat ~/List.txt | sed -e 1d -e 's/\x1b\[1m//g' -e 's/\x1b\[22m : \x1b\[35m/|---|/g' -e 's/\x1b\[39m : /|---| /g' -e 's/.|---|*//' -e 's/|---|*//' -e 's/\x1b*\[34m/(/g' -e 's/\x1b\[39m/)/g' -e 's/^/FALSE /' -e '0,/FALSE /s//TRUE /' > sedList.txt
This is the sedList.txt which has spaces between the words:
TRUE 0 This has SPACES inside, Must be DOTS! (123.123ABCD)
FALSE 1 This-DONT-have(SPACES)-inside (900.578CD)
FALSE 2 This SPACE!!! inside, # Must be DOTS! (9K99123AD)
FALSE 3 SPACES *Must* be DOTS! (AB)
FALSE 4 Must[be] [DOTS] ! (12.AZZZ)
FALSE 5 SPACES ~DOTS! (654KK45)
I want to replace those spaces with dots in the specific location (not everything) so the sedList.txt looks exacly like this:
TRUE 0 This.has.SPACES.inside,.Must.be.DOTS! (123.123ABCD)
FALSE 1 This-DONT-have(SPACES)-inside (900.578CD)
FALSE 2 This.SPACE!!!.inside,.#.Must.be.DOTS! (9K99123AD)
FALSE 3 SPACES.*Must*.be.DOTS! (AB)
FALSE 4 Must[be].[DOTS].! (12.AZZZ)
FALSE 5 SPACES.~DOTS! (654KK45)
So what is missing from my sed equation should i add something?