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

  • Home
  • SEARCH
  • 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 7855859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T20:30:36+00:00 2026-06-02T20:30:36+00:00

I have this command: $ find $PWD -name *.jpg | awk ‘{system( echo $(sub(/\//,

  • 0

I have this command:

$ find $PWD -name "*.jpg" | awk '{system( "echo "  $(sub(/\//, "_")) ) }'
_home/mol/Pulpit/test/1.jpg

Now the same thing, but using gsub:

$ find $PWD -name "*.jpg" | awk '{system( "echo "  $(gsub(/\//, "_")) ) }'

mol@mol:~

I want to get the result:

_home_mol_Pulpit_test_1.jpg

Thank you for your help.

EDIT:

I put ‘echo’ to test the command:

$ find $PWD -name "*.jpg" | awk '{gsub("/", "_")} {system( "echo " mv $0 " " $0) }'
_home_mol_Pulpit_test_1.jpg _home_pic_Pulpit_test_1.jpg

mol@mol:~

I want to get the result:

$ find $PWD -name "*.jpg" | awk '{gsub("/", "_")} {system( "echo " mv $0 " " $0) }'
/home/pic/Pulpit/test/1.jpg  _home_pic_Pulpit_test_1.jpg
  • 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-02T20:30:39+00:00Added an answer on June 2, 2026 at 8:30 pm

    That won’t work if the string contains more than one match… try this:

    echo "/x/y/z/x" | awk '{ gsub("/", "_") ; system( "echo "  $0) }'
    

    or better (if the echo isn’t a placeholder for something else):

    echo "/x/y/z/x" | awk '{ gsub("/", "_") ; print $0 }'
    

    In your case you want to make a copy of the value before changing it:

    echo "/x/y/z/x" | awk '{ c=$0; gsub("/", "_", c) ; system( "echo " $0 " " c )}'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following command find . -name *.tiff -exec echo `basename -s .tiff
I have this incomplete command: find /var/www/vhosts/domain/folder/ -name '*.flv' -size +5000k && /bin/mail -s
I have this function: function! Find(name) let l:list=system(find . -name '.a:name.' | perl -ne
I used this command to find mp3 files and write their name on log.txt:
I have a PHP script that runs this command: system(pdftohtml -i -noframes /home/myacc/pdfs/test.pdf); When
I find unxutils and and gnuwin32 Packages don't have this command...
I have this command that I run everyday via cron: find /home/get/public_html/videos -daystart -maxdepth
I have this command that I run every 24 hours currently. find /var/www/html/audio -daystart
This command will count the number of files in the sub-directories. find . -maxdepth
i have this command. ping -n 1 piratelufi.com | find /i reply from i

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.