Skip to main content
Became Hot Network Question
edited tags, title, text
Source Link
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k

trim and join Replace prefix string from lines ofin a file, and put into a bash array

inIn the file groupAfiles.txt are the lines:

file14
file2
file4
file9

iI need a way to convert them to remoeremove file and add /dev/loop and put them all in one line with a space between them.

/dev/loop14 /dev/loop2 /dev/loop4 /dev/loop9

/dev/loop14 /dev/loop2 /dev/loop4 /dev/loop9

and thanThen I need to put this in an array.

(but the numbers change)

how toHow do I do this?

trim and join lines of a file

in the file groupAfiles.txt are the lines:

file14
file2
file4
file9

i need a way to convert them to remoe file and add /dev/loop and put them all in one line with a space between.

/dev/loop14 /dev/loop2 /dev/loop4 /dev/loop9

and than to put this in an array

(but the numbers change)

how to do?

Replace prefix string from lines in a file, and put into a bash array

In the file groupAfiles.txt are the lines:

file14
file2
file4
file9

I need a way to convert them to remove file and add /dev/loop and put them all in one line with a space between them.

/dev/loop14 /dev/loop2 /dev/loop4 /dev/loop9

Then I need to put this in an array.

(but the numbers change)

How do I do this?

edited title
Link
Stéphane Chazelas
  • 584.6k
  • 96
  • 1.1k
  • 1.7k

Dont know the right topic at the moment trim and join lines of a file

Source Link
user447274
  • 539
  • 2
  • 10

Dont know the right topic at the moment

in the file groupAfiles.txt are the lines:

file14
file2
file4
file9

i need a way to convert them to remoe file and add /dev/loop and put them all in one line with a space between.

/dev/loop14 /dev/loop2 /dev/loop4 /dev/loop9

and than to put this in an array

(but the numbers change)

how to do?