To skip lines starting with #
:
grep -v '^#' myfile | while read -r file ; do
...
done
Modify the grep
command as needed to, for example, skip lines starting with whitespace and a #
character.
More Related Contents:
- How to put a line comment for a multi-line command [duplicate]
- How can I escape white space in a bash loop list?
- Emulating a do-while loop in Bash
- How do you run a command eg chmod, for each line of a file?
- Looping through alphabets in Bash
- Is there a better way to run a command N times in bash?
- Commenting in a Bash script inside a multiline command
- How to loop through dates using Bash?
- Looping through all files in a directory [duplicate]
- Bash scripting, multiple conditions in while loop
- Syntax for a single-line while loop in Bash
- How to iterate over list which contains whitespaces in bash
- Retry a Bash command with timeout
- How can I manipulate text in bash? [closed]
- How to iterate over arguments in a Bash script
- Meaning of “[: too many arguments” error from if [] (square brackets)
- Error when using ‘sed’ with ‘find’ command on OS X: “invalid command code .”
- Best way to make a shell script daemon?
- What does -z mean in Bash? [duplicate]
- Parse Date in Bash
- Simple method to shuffle the elements of an array in BASH shell?
- Grepping a huge file (80GB) any way to speed it up?
- Launch Google Chrome from the command line with specific window coordinates
- How does AND and OR operators work in Bash?
- How to effectively abort the execution of a Bash script from a function
- How can I check if a package is installed and install it if not?
- reverse the order of characters in a string
- Why doesn’t my terminal output unicode characters properly?
- Read stdin for user input when a file is already redirected to stdin [duplicate]
- How to get bc to handle numbers in scientific (aka exponential) notation?