Saturday, September 5, 2009

Removing unwanted characters from a text file with grep

# This worked pretty good when I was getting strange characters from uploading a google text file to my linux box
#I couldn't import into mysql
#So I did this:

cat $1 | grep -o "[a-zA-Z,;()0-9_ ][a-zA-Z,;()0-9_ *@'.]*" > output.sql

#this command greps for only letters,commas, numbers, underscores, parenthesis, semicolons, astericks, and at signs.

No comments:

Post a Comment