I'm trying to learn regular expressions, and so I created a file with some characters in it. When I use the cat command and pipe it to rgrep command with an argument to filter out text, the resulting output is "filename:filtered_text".
cat regex.txt | rgrep -E '^a'
regex.txt:a
regex.txt:aa
regex.txt:aaa
regex.txt:aaaa
regex.txt:aaaaa
regex.txt:aaaaaa
file:acpi
file:adduser.conf
file:aliases
file:aliases.db
file:alternatives
file:anacrontab
file:apache2
file:apg.conf
file:apm
file:apparmor
file:apparmor.d
file:apport
file:appstream.conf
file:apt
file:avahi
Not only that it also checks for other files in the folder and if they match the regular expression it shows them as well, even though I only piped a single file.
How do I get a normal output with only the contents of the file I've passed into cat?
-R
flag?cat
doesn't output the file names.cat < regex.txt
?