grep -v '^[ ]*1'
explain what is the output of the command.
grep -v '^[ ]*1'
explain what is the output of the command.
Hello dineshaila,
Following may help you in same.
cat Input_file
<a><b>Bee</b><c>Sea</c><d><e>Eeeh!</e></d></a>
1dtessd vufgugyug hgyugg
Then following command we ran as follows:
grep -v '^ *1' Input_file
So output will be as follows.
<a><b>Bee</b><c>Sea</c><d><e>Eeeh!</e></d></a>
So basically -v
option omits the line to print if pattern following it is matched like as above(It is not printing the second line because it starts with a space and then followed by digit 1
), which actually satisfy the regex provided after -v
option. You could read man page for grep
too by doing man grep
.
Thanks,
R. Singh
it is also not printing
echo "123"|grep -v '^[ ]*1'
if the pattern contains 1
As Ravinder already wrote -v
omitts the printing of the matching lines. The *
stands for any number of the former character (a blank), even none.
So it does not print this.