Sed чуть более усложняет вещи ... вы можете использовать grep, чтобы легко с этим справиться!
egrep "^[^a].+\.html$" -f sourcefile > text.txt
//loads file from within the program egrep
egrep "^[^a].+\.html$" < sourcefile > text.txt
//Converts stdin file descriptor with the input redirect
//to sourceFile for this stage of the` pipeline
эквивалентны функционально.
или
pipe input | xargs -n1 egrep "^[^a].+\.html$" > text.txt
//xargs -n1 means take the stdin from the pipe and read it one line at a time in conjunction with the single command specified after any other xargs arguments
// ^ means from start of line,
//. means any one character
//+ means the previous matched expression(which can be a
//(pattern group)\1 or [r-ange], etc) one or more times
//\. means escape the single character match and match the period character
//$ means end of line(new line character)
//egrep is short for extended regular expression matches which are really
nice(при условии, что вы не используете pipe или cat и т. д.)
Вы можете преобразовать файл с разделителями новой строки в одну строку ввода с помощью этой команды:
cat file | tr -d '\n' ' '
//It converts all newlines into a space!
В любом случае, проявите творческий подход спростые утилиты, и вы можете многое:
xargs, grep, tr - это хорошая комбинация, которую легко освоить. Без всякой соблазнительности.