Hi Bakunin,
That's certainly the kind of solution I am looking for. Unfortunately it doesn't quite do what I want, probably my fault for not taking a real file home with me.
I am back in work this morning and have just tried it against a real sample file -
"channel.facebook.com","['unknown', 'productivityloss']","[1001005, 1000041]","['standard', 'web2']"
"channel.facebook.com","['unknown', 'productivityloss']","[1001005, 1000041]","['standard', 'web2']"
"channel.facebook.com","['unknown', 'productivityloss']","[1001005, 1000041]","['standard', 'web2']"
"channel.facebook.com","['unknown', 'productivityloss']","[1001005, 1000041]","['standard', 'web2']"
"channel.facebook.com","['unknown', 'productivityloss']","[1001005, 1000041]","['standard', 'web2']"
Output of sed command -
"channel.facebook.com","'unknown', 'productivityloss'","1001005, 1000041","'standard', 'web2'"
"channel.facebook.com","'unknown', 'productivityloss'","1001005, 1000041","'standard', 'web2'"
"channel.facebook.com","'unknown', 'productivityloss'","1001005, 1000041","'standard', 'web2'"
"channel.facebook.com","'unknown', 'productivityloss'","1001005, 1000041","'standard', 'web2'"
"channel.facebook.com","'unknown', 'productivityloss'","1001005, 1000041","'standard', 'web2'"
So where I have single quoted strings inside brackets, I'm not losing the brackets.
This might be me, I had to change the outer quotes on your sed to " in order to get it to run -
sed ":start
/\[[^]]*\'\]/ {
s/\(\[[^]]*\)\'/\1/
b start
}
s/\[\([^]]*\)\]/\1/g" $File
Would you be kind enough to explain how the sed works? I am trying to get to grips with sed and would appreciate the insight.
Thanks for the help
The perl will get me out of trouble for now, but I'm not sure it is installed on all of our servers so would prefer a sed solution if possible for portability.
Brad