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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:18:40+00:00 2026-06-05T05:18:40+00:00

So I have the following script (just a test) #!/bin/bash for file in *

  • 0

So I have the following script (just a test)

 #!/bin/bash
 for file in *
 do
 echo $file 
 done

And I’m trying to add parenthesis around file. I’m also pretending I dont know the full name of the variable file.

  cat sc.sh | sed 's/fi*/(&)/g'
  #!/bin/bash
  (f)or (fi)le in *
  do
  echo $(fi)le
  done

So basically I’m trying to match words beginning with fi and adding parenthesis around them. What am I doing wrong? I tried a number of variations to that but it didn’t work. From what I can see the command matches any f or fi and adds parenthesis around them but not the whole word. Why?

Any help would be greatly appreciated.

  • 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-05T05:18:42+00:00Added an answer on June 5, 2026 at 5:18 am

    Your regex fi* is looking for an f followed by 0 or more i’s. You probably want something more like this:

    cat tmp | sed 's/\bfi[^ ]*/(&)/g'
    

    \bfi looks for a word boundary (i.e. the start of a word) followed by ‘fi’. Then [^ ]* matches the remaining (non-space) characters in the word.

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

Sidebar

Related Questions

I have the following AutoIt script: Run(Notepad.exe, @WindowsDir, @SW_MAXIMIZE) Sleep(1000) Send(Just a test) $anPos
I have the following code: echo <script type='text/javascript'> if(window.location.href.toLowerCase().indexOf('test') != -1) { } else
Let’s say I have the following Bash script: while read SCRIPT_SOURCE_LINE; do echo $SCRIPT_SOURCE_LINE
I have the following dummy test script: function test() { var x = 0.1
In my javascript file I have the following: <script type=text/javascript src=https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js></script> <script type=text/javascript> $.ajax({
I have the following code (just a test): var engine = Python.CreateEngine(); var runtime
I have the following script: import os import stat curDir = os.getcwd()+'/test' for (paths,
I have following small script to preview some text before submitting it to store
I have the following script which first shows only the first para of the
I have the following script: Timer=0; function countdown(auctionid){ var auctions; var divs; Timer=Timer+1; if((Timer%10==0)||(Timer==1)){

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.