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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:39:23+00:00 2026-06-16T05:39:23+00:00

I am a new to Unix. ${AWK} ‘\!/^ / && \!/^-/ && \!/^</ &&

  • 0

I am a new to Unix.

${AWK} '\!/^ / && \!/^-/ && \!/^</ && \!/^$/ {printf "%s,,N,N,N,,,,\n", $1}' ~/ozserver.txt

When I run the command like before, there’s errorInfo printed to the Cygwin window as follow:

awk: commandline:1: ^ backslash not last character on line

Actually, my role is translate csh to bash for the learning. I didn’t wrote that code. So, what I know is:

"\!/regex/" : is a model unit."\" is belong to the awk synax for cut down the long sentence
"!"means logical NOT,"/regex/" means one model.btw,"&&" means logical AND.

I just can’t figure out where is wrong. Can anyone give me a sign?

  • 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-16T05:39:24+00:00Added an answer on June 16, 2026 at 5:39 am

    The csh ‘metasyntactic zoo’ means that ! is a history operator even inside single quotes, or something like that. In sane^H^H^H^H shells derived from Bourne shell, the ! is not such a big problem, and you can simply write:

    ${AWK} '!/^ / && !/^-/ && !/^</ && !/^$/ {printf "%s,,N,N,N,,,,\n", $1}' ~/ozserver.txt
    

    Of course, that can be simplified still further:

    ${AWK} '!/^[- <]/ && !/^$/ {printf "%s,,N,N,N,,,,\n", $1}' ~/ozserver.txt
    

    That looks for the start of line followed by something other than blank, dash or less than (that isn’t an empty line). That too can be simplified by using a negated character class:

    ${AWK} '/^[^- <]/ {printf "%s,,N,N,N,,,,\n", $1}' ~/ozserver.txt
    

    That looks for a line starting with a character other than blank, dash or less than (but it must contain at least one character, so empty lines are automatically excluded). And the last version might even work OK in csh too since it does not use any ! at all.

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

Sidebar

Related Questions

I would like to create a new unix command to automatically list the contents
I am new to Unix shell scripting and would like some help with writing
I am very new to the unix. I ran the following command. ls -l
I'm reading The UNIX Programming Environment and in Section 4.4, about awk, there is
I am new to Unix and I am having trouble understanding the grep command,
I'm still new to Unix. Is it possible to run multiple commands of Unix
I am new to unix commands. I have a file named server.txt, which has
I am new to unix and would like to be able to do the
I am new to Unix grep and i would like some help to come
I've got a VPS setup with Nginx & PHP5-FPM. Being fairly new to unix,

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.