Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-14-2015, 09:14 AM   #1
Registered: Apr 2014
Distribution: Debian GNU/Linux 7.5 (wheezy)
Posts: 236

Rep: Reputation: Disabled
Problem with .bashrc entry

I need to execute this .bashrc string:

alias lml='grep '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' mail.log | grep "relay=" | awk '{print $8}'' #list mail log

I have tried enclosing the string in alias as lml="..." and alias lml=`...` to no avail. The problem is apparently with the grep "relay=" in that it has to be enclosed in "", as well as the awk that has to be enclosed in ''.

Any ideas on how to get this setup? Thanks.
Old 02-14-2015, 09:43 AM   #2
Senior Member
Registered: Dec 2009
Posts: 1,387

Rep: Reputation: 173Reputation: 173
small script maybe?
Old 02-14-2015, 11:13 AM   #3
Senior Member
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Try this:

alias lml="grep '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' mail.log | grep 'relay=' | awk '{print $8}'"

It was actually a shell quoting problem.
Old 02-14-2015, 06:40 PM   #4
Registered: Apr 2014
Distribution: Debian GNU/Linux 7.5 (wheezy)
Posts: 236

Original Poster
Rep: Reputation: Disabled
No, that doesn't work. It gives me this:

Feb 14 17:34:52 me postfix/smtp[31127]: 7B95481E68: to=<>,[123.456.78.90]:25, delay=1.7, delays=0.02/0.02/0.86/0.83, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as A2F12380413)

where I am looking for this (which is what the string gives when executed at prompt):[123.456.78.90]:25,

The script idea is probably the best.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] /etc/bashrc ,dircolors and /root/.bash_profile ,/.bashrc not exist in LFS-7.5(sec9.3) jaassi Linux From Scratch 2 09-20-2014 06:04 PM
~/.bashrc, /etc/bash.bashrc files not read? Tachtory Slackware 3 01-04-2014 01:25 AM
[SOLVED] How to use my /home/kangjoo/.bashrc rather than root/.bashrc kangjoo.lee Linux - Newbie 2 11-05-2012 04:38 PM
Setting path: /etc/profile, /etc/bashrc or ~/.bashrc Swakoo Linux - General 1 08-07-2007 11:59 PM
.bashrc problem davis2199 Linux - Software 1 09-02-2003 04:45 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:45 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration