Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8529661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:04:54+00:00 2026-06-11T09:04:54+00:00

I want to set up a bash alias to grep all logs in a

  • 0

I want to set up a bash alias to grep all logs in a directory automatically; however, to make this user-friendly, I need to escape the periods and add a whitespace boundary so grep won’t match too many lines.

First I checked to be sure that I had the right syntax to escape an address…

[mpenning@sasmars daily]$ echo 1.1.1.1 | sed "s/\./\\\\./g"
1\.1\.1\.1
[mpenning@sasmars daily]$

Next I tried to escape a CLI argument… but it’s not quite getting me there…

[mpenning@sasmars daily]$ alias tryme='echo `sed "s/$argv[1]/\\\\./g"`'
[mpenning@sasmars daily]$ tryme 1.1.1.1

-> Indefinite hang until I hit cntlc

I realize that echo isn’t going to search, but this was a simple test.

What is the simplest way to escape periods in arguments to a bash alias?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T09:04:55+00:00Added an answer on June 11, 2026 at 9:04 am

    What you want is a function, and you can use bash’s builtin replacement syntax:

    $ function tryme() { echo "${1//./\.}"; }
    $ tryme 1.1.1.1
    1\.1\.1\.1
    $ tryme "also. with ... spaces"
    also\. with \.\.\. spaces
    

    This will avoid you from forking a sed process.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my bash script - I just want to left-pad a set of
I want to set an alias like so: alias hi='TEST=ok echo $TEST' However, it
Possible Duplicate: variable interpolation in bash alias This command is used to set the
I would like to set a variable in bash called test_var Basically, I want
I want to set an alias to my installation of firefox so I can
I want to execute a set of commands optionally in background and with bash.
I want to make a bash script that echo's something into one of the
Using bash, I want to find the operating system and notify the user. I
I want set interfaceOrientation in one UIView as LandscapeLeft and Portrait in other UIView.
i want set the visibility to itemized overlay in map view. if the zoom

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.