I am obviously missing something basic here but can someone explain to me what is wrong with the first statement, which returns nothing?
$ history | grep ^su $ history | grep su 2997 su -l 3024 su -l 3050 su -l 3054 su -l
Thanks,
there are numbers at the start of the line?
e.g. your regex is actually something more like "^[0-9]+ su" and depending on your unix variant (e.g. not a linux, possibly) you really mean egrep and not grep (although to a centos list, yes they're likely actually the same, but it still might be worth noting)
On Mon, Sep 16, 2013 at 12:27 PM, James B. Byrne byrnejb@harte-lyne.cawrote:
I am obviously missing something basic here but can someone explain to me what is wrong with the first statement, which returns nothing?
$ history | grep ^su $ history | grep su 2997 su -l 3024 su -l 3050 su -l 3054 su -l
Thanks,
-- *** E-Mail is NOT a SECURE channel *** James B. Byrne mailto:ByrneJB@Harte-Lyne.ca Harte & Lyne Limited http://www.harte-lyne.ca 9 Brockley Drive vox: +1 905 561 1241 Hamilton, Ontario fax: +1 905 561 0757 Canada L8E 3C3
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
On Mon, Sep 16, 2013 at 11:27 AM, James B. Byrne byrnejb@harte-lyne.ca wrote:
I am obviously missing something basic here but can someone explain to me what is wrong with the first statement, which returns nothing?
$ history | grep ^su $ history | grep su 2997 su -l 3024 su -l 3050 su -l 3054 su -l
Someone else already pointed out the line numbers, but if you are doing this interactively, you probably really want bash's internal 'search-history' operations (usually control-r for reverse-search-history, but there are a bunch of options).
On Mon Sep 16 16:34:31 UTC 2013, zGreenfelder zgreenfelder at gmail.com wrote:
On Mon, Sep 16, 2013 at 12:27 PM, James B. Byrne <byrnejb at harte-lyne.ca>wrote:
I am obviously missing something basic here but can someone explain to me what is wrong with the first statement, which returns nothing?
$ history | grep ^su $ history | grep su 2997 su -l 3024 su -l 3050 su -l 3054 su -l
there are numbers at the start of the line?
Duh! Thanks. I could not see the forest for the trees I guess. I ended up with the following as I wanted a visual scan of all variants not just the most recent:
history | cut -f1-3 -d " " --complement | grep ^su
This is in the bash shell on CentOS-6.4.
maybe
history | awk '$2 ~ /ssh/ {$1=""; print $0}' | sort -u
On 16 September 2013 21:14, James B. Byrne byrnejb@harte-lyne.ca wrote:
On Mon Sep 16 16:34:31 UTC 2013, zGreenfelder zgreenfelder at gmail.comwrote:
On Mon, Sep 16, 2013 at 12:27 PM, James B. Byrne <byrnejb at harte-lyne.ca>wrote:
I am obviously missing something basic here but can someone explain to me what is wrong with the first statement, which returns nothing?
$ history | grep ^su $ history | grep su 2997 su -l 3024 su -l 3050 su -l 3054 su -l
there are numbers at the start of the line?
Duh! Thanks. I could not see the forest for the trees I guess. I ended up with the following as I wanted a visual scan of all variants not just the most recent:
history | cut -f1-3 -d " " --complement | grep ^su
This is in the bash shell on CentOS-6.4.
-- *** E-Mail is NOT a SECURE channel *** James B. Byrne mailto:ByrneJB@Harte-Lyne.ca Harte & Lyne Limited http://www.harte-lyne.ca 9 Brockley Drive vox: +1 905 561 1241 Hamilton, Ontario fax: +1 905 561 0757 Canada L8E 3C3
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos