How can I prevent print results from matching?

I use eda bash script to search for a file; the command will /display content that I do not want. I tried redirecting >/dev/null 2>&1, but this did not work for me.

text file foo.txt:

a
b
c

bash script bar.sh:

ed -s foo.txt << EOF
/b/
EOF
> /dev/null 2>&1

result:

$ ./bar.sh
b

How to stop edprinting a consistent line b?

+4
source share
2 answers

I think you mean this:

ed -s foo.txt > /dev/null <<eof
/b/
eof
+4
source

You can use the comment command to jump to a consistent line without printing the result.ed /b/;#

According to the eddocumentation

'(.,.)#'

; , ,      . , ,       .       .

+1

All Articles