Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

The middle part

Status
Not open for further replies.

mcstafford

Technical User
Oct 28, 2010
2
Hello,

I would like to transform this:
/*!40101 SET character_set_client = utf8 */;

into this:
SET character_set_client = utf8;

I can highlight the parts I want to remove using grep, e.g.

Code:
grep --extended-regexp '^\/\*![0-9]{5}' file.txt
# or
grep --extended-regexp '\*\/$' file.txt

How do you recommend I clear out the bits I don't want?

Thanks,

Mark
 
This? (I just typed this, it is untested)
Code:
awk '/*\/;$/{
 for (i=2;i<NF;i++){
  printf "%s ",$i
 }
 printf "\n"
}' /path/to/inputfile


HTH,

p5wizard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top