![]() |
bash script to delete all comments after '#'??
i need to make bash script than can delete all comment (all char after '#' in each line) in a single file.... I think it using grep? how to do make that? thanks a lot.....
|
Since there's only a single matching reqirement this is a very easy task. You can do it with a simple sed replacement:
sed "s/#.*//" textfile.txt |
Quote:
|
Quote:
|
"have to use grep"----I assume because the instructor said so?
In addition to the advice above, you'll also be interested in the redirection operators (< and >), and the -i option in SED. Depending on what texts are used in the class, you may want to get a copy of the Bash Guide for Beginners---- free at http://tldp.org |
| All times are GMT -5. The time now is 09:27 AM. |