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 1094875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:02:09+00:00 2026-05-17T00:02:09+00:00

% cat temp $$$ hello1 $$ hello2 hello3 ## hello4 hello5 $$$ % cat

  • 0
% cat temp
$$$ hello1
$$  hello2
    hello3
##  hello4
    hello5 $$$
% cat temp | grep "$$$"
Illegal variable name.
% cat temp | grep "\$\$\$"
Variable name must contain alphanumeric characters.
%

I want to grep for $$$ and I expect the result to be

% cat temp | grep <what should go here?>
$$$ hello1
    hello5 $$$
%

To differentiate, I have marked the prompt as %.

  • What is the problem here?
  • What should the grep string be?
  • 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-05-17T00:02:10+00:00Added an answer on May 17, 2026 at 12:02 am

    The problem is that the shell expands variable names inside double-quoted strings. So for "$$$" it tries to read a variable name starting with the first $.

    In single quotes, on the other hand, variables are not expanded. Therefore, '$$$' would work – if it were not for the fact that $ is a special character in regular expressions denoting the line ending. So it needs to be escaped: '\$\$\$'.

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

Sidebar

Related Questions

/bin/ksh -c cat $PMSourceFileDir/RT/TgtFiles/$OutputFileStrPerfHdr $PMSourceFileDir/RT/TgtFiles/$OutputFileStrPerfCSV | unix2dos -437 > $PMRootDir/RT/Temp/$OutputFileStrPerfCSV I work in IBM
cat /dev/urandom is always a fun way to create scrolling characters on your display,
$ cat temp.pl use strict; use warnings; print 1\n; print hello, world\n; print 2\n;
cat test.txt #this is comment line 1 line 2 #this is comment at line
% CAT(2,A,B) is the same as [A,B]. % CAT(1,A,B) is the same as [A;B].
$ cat file.txt one two three $ cat file.txt | sed s/one/1/ 1 two
$ cat Const.java public class Const { String Const(String hello) { return hello; }
I want to cat all the files in a directory, but include some spacer
I am using cat *.txt to merge multiple txt files into one, but I
cal April 2012 | cat > t | cat < t | more Why

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.