Ask Ubuntu Asked by I don't like shell script on November 21, 2020
This is my code:
#!/bin/bash
echo "Type in your file"
read file
sed -r -e 's/(^[^#]*$) ; s/(^[^;]*$) ; s/(^[^$]*$) ; s/(^[^/]*$) ; s/(^[^ ]*$)' $file
This is the output when I give it a file:
sed: -e expression #1, char 31: unknown option to `s’
Why am I getting this error? Would you suggest another way to do it?
Thanks in advance
Should remove most comments and empty lines:
pcre2grep -v '^[[:blank:]]*([#;]|//|$)' file
Answered by bac0n on November 21, 2020
This might help more:
grep -Ev '^s+$|^#' file.txt
Answered by waltinator on November 21, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP