Skip to main content

All Questions

Tagged with
3 votes
1 answer
2k views

egrep in bash script not working

I have this set of commands : s3ls="aws s3 ls $ssyss3/ --recursive --human-readable --summarize" egrepCommand="egrep '$currentDate|Total'" totalSize=$(echo $s3ls|$egrepCommand| awk -F 'Total Size:' '{...
user352882's user avatar
5 votes
1 answer
442 views

Different output when alias

I have a command set as an alias like this: alias badalarm="cat ~/sagLogs/* | grep -I 'failed to generate expected' | awk '{print $4}' | sort | uniq | tee /dev/tty | wc -l" It gives me this output: ...
KuboMD's user avatar
  • 439
1 vote
1 answer
1k views

Alias grep quote usage

I'm trying to make an alias in the bashrc file but having issues. I want the command to grep the access logs of our server for a particular IP address. My current entry is: alias ip_usage='sudo grep "...
user avatar
3 votes
1 answer
613 views

Bash alias problem

I can't understand why using alias prompts an error, but using the same syntax without alias does not... alias grep='egrep -iIs ' 19:47:24 ~ cat /etc/services | \grep ssh ssh 22/tcp #...
johnmuir's user avatar
12 votes
3 answers
2k views

How to extend bash aliases

How to create an alias that actually extends another alias of the same name in Bash? Why: I used to have GREP_OPTIONS set on .bashrc to something like this: GREP_OPTIONS="-I --exclude=\*~" I also ...
brandizzi's user avatar
  • 2,944
3 votes
2 answers
10k views

Why am I getting "invalid max count" from grep in an alias?

So the idea is to create an alias that will search my alias's for me. I have quite a few. dude@gnarleybox:~$ grep alg .bash_aliases.sh alias alg='alias | grep ' dude@gnarleybox:~$ alias | grep alg ...
user447607's user avatar
3 votes
3 answers
11k views

How can I use grep to search for lines that start with a certain character in bash

I want an alias ('ggg') that will look through my existing set of aliases and tell me all the ones that begin with g. I have a lot of g* aliases :) I tried this: alias ggg='alias | grep ^g' but didn'...
Michael Durrant's user avatar
1 vote
3 answers
2k views

A problem with find and grep

I have defined the following alias in ~/.bashrc: alias fg='find . -name $1 | xargs grep --color $2' in order to write fg "*.txt" " my_text " and find all file that have extension .txt and contain "...
Narek's user avatar
  • 127