dosth.sh:
#!/bin/bash VALUE=`cat $1 | grep <your regexp here>` echo $VALUE
it can be used as:
$ ./dosth.sh a.txt
then the found lines are stored in the VALUE variable
You can also give regexp for some arguments (given the file name using the script):
dosth.sh:
#!/bin/bash echo -e "Which file do you want to grep?" read FILENAME args=(" $@ ") VALUE=`cat $FILENAME | grep $args` echo $VALUE
which can be used as:
$ ./dosth.sh here comes my * pattern
Perhaps this link is useful to you: Link
bully source share