Skip to main content
added 2 characters in body
Source Link
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 263

I'm writtingwriting the shell script that should process through some text, I've got the text like that:

read build { file1 file2 file3 }
check build { file2 file3 file4 }
read build { file4 file5 file6 }

I wannawant to add some text before all files - that means words, that are included between brackets in 'read build' lines, what do you think is the best idea to achieve that? The results should look like that:

read build { MY_ADDED_WORDfile1 MY_ADDED_WORDfile2 MY_ADDED_WORDfile3 }
check build { file2 file3 file4 }
read build { MY_ADDED_WORDfile4 MY_ADDED_WORDfile5 MY_ADDED_WORDfile6 }

I was trying with greping that lines, next parsing it to array and concatconcatenate this "file" strings with the word I wannawant to add, but I think that is not a "smart" solution. Thanks for your help.

Input files look like this:

set build { file1 file2 file3 file4 }
check $build

read build -new -f $build
read build -new -f { fileA fileB fileC fileD }

set build {file5 file6 file7 }

read build -old -f $build
read build -old -f { fileX fileZ fileD }

check_that_building

Output should look like that:

set build { file1 file2 file3 file4 }
check $build

read build -new -f $build
read build -new -f { MY_ADDED_WORDfileA MY_ADDED_WORDfileB MY_ADDED_WORDfileC MY_ADDED_WORDfileD }

set build {file5 file6 file7 }

read build -old -f $build
read build -old -f { MY_ADDED_WORDfileX MY_ADDED_WORDfileZ MY_ADDED_WORDfileD }

check_that_building

There is always a space before opening bracket but it can be a situation that there will be not a space after opening bracket, there can a space before closing bracket but it's not always. Possible cases:

read build -old -f { fileX fileZ fileD }
read build -old -f {fileX fileZ fileD }
read build -old -f { fileX fileZ fileD}
read build -old -f {fileX fileZ fileD}

I'm writting the shell script that should process through some text, I've got the text like that:

read build { file1 file2 file3 }
check build { file2 file3 file4 }
read build { file4 file5 file6 }

I wanna to add some text before all files - that means words, that are included between brackets in 'read build' lines, what do you think is the best idea to achieve that? The results should look like that:

read build { MY_ADDED_WORDfile1 MY_ADDED_WORDfile2 MY_ADDED_WORDfile3 }
check build { file2 file3 file4 }
read build { MY_ADDED_WORDfile4 MY_ADDED_WORDfile5 MY_ADDED_WORDfile6 }

I was trying with greping that lines, next parsing it to array and concat this "file" strings with the word I wanna to add, but I think that is not a "smart" solution. Thanks for your help.

Input files look like this:

set build { file1 file2 file3 file4 }
check $build

read build -new -f $build
read build -new -f { fileA fileB fileC fileD }

set build {file5 file6 file7 }

read build -old -f $build
read build -old -f { fileX fileZ fileD }

check_that_building

Output should look like that:

set build { file1 file2 file3 file4 }
check $build

read build -new -f $build
read build -new -f { MY_ADDED_WORDfileA MY_ADDED_WORDfileB MY_ADDED_WORDfileC MY_ADDED_WORDfileD }

set build {file5 file6 file7 }

read build -old -f $build
read build -old -f { MY_ADDED_WORDfileX MY_ADDED_WORDfileZ MY_ADDED_WORDfileD }

check_that_building

There is always a space before opening bracket but it can be a situation that there will be not a space after opening bracket, there can a space before closing bracket but it's not always. Possible cases:

read build -old -f { fileX fileZ fileD }
read build -old -f {fileX fileZ fileD }
read build -old -f { fileX fileZ fileD}
read build -old -f {fileX fileZ fileD}

I'm writing the shell script that should process through some text, I've got the text like that:

read build { file1 file2 file3 }
check build { file2 file3 file4 }
read build { file4 file5 file6 }

I want to add some text before all files - that means words, that are included between brackets in 'read build' lines, what do you think is the best idea to achieve that? The results should look like that:

read build { MY_ADDED_WORDfile1 MY_ADDED_WORDfile2 MY_ADDED_WORDfile3 }
check build { file2 file3 file4 }
read build { MY_ADDED_WORDfile4 MY_ADDED_WORDfile5 MY_ADDED_WORDfile6 }

I was trying with greping that lines, next parsing it to array and concatenate this "file" strings with the word I want to add, but I think that is not a "smart" solution. Thanks for your help.

Input files look like this:

set build { file1 file2 file3 file4 }
check $build

read build -new -f $build
read build -new -f { fileA fileB fileC fileD }

set build {file5 file6 file7 }

read build -old -f $build
read build -old -f { fileX fileZ fileD }

check_that_building

Output should look like that:

set build { file1 file2 file3 file4 }
check $build

read build -new -f $build
read build -new -f { MY_ADDED_WORDfileA MY_ADDED_WORDfileB MY_ADDED_WORDfileC MY_ADDED_WORDfileD }

set build {file5 file6 file7 }

read build -old -f $build
read build -old -f { MY_ADDED_WORDfileX MY_ADDED_WORDfileZ MY_ADDED_WORDfileD }

check_that_building

There is always a space before opening bracket but it can be a situation that there will be not a space after opening bracket, there can a space before closing bracket but it's not always. Possible cases:

read build -old -f { fileX fileZ fileD }
read build -old -f {fileX fileZ fileD }
read build -old -f { fileX fileZ fileD}
read build -old -f {fileX fileZ fileD}
added 821 characters in body
Source Link

I'm writting the shell script that should process through some text, I've got the text like that:

read thatbuild { file1 file2 file3 }
check thatbuild { file2 file3 file4 }
read thatbuild { file4 file5 file6 }

I wanna to add some teksttext before all files - that means words, that are included between brackets in 'read that'build' lines, what do you think is the best idea to achieve that? The results should look like that:

read thatbuild { MY_ADDED_WORDfile1 MY_ADDED_WORDfile2 MY_ADDED_WORDfile3 }
check thatbuild { file2 file3 file4 }
read thatbuild { MY_ADDED_WORDfile4 MY_ADDED_WORDfile5 MY_ADDED_WORDfile6 }

I was trying with greping that lines, next parsing it to array and concat this "file" strings with the word I wanna to add, but I think that is not a "smart" solution. Thanks for your help.

Input files look like this:

set build { file1 file2 file3 file4 }
check $build

read build -new -f $build
read build -new -f { fileA fileB fileC fileD }

set build {file5 file6 file7 }

read build -old -f $build
read build -old -f { fileX fileZ fileD }

check_that_building

Output should look like that:

set build { file1 file2 file3 file4 }
check $build

read build -new -f $build
read build -new -f { MY_ADDED_WORDfileA MY_ADDED_WORDfileB MY_ADDED_WORDfileC MY_ADDED_WORDfileD }

set build {file5 file6 file7 }

read build -old -f $build
read build -old -f { MY_ADDED_WORDfileX MY_ADDED_WORDfileZ MY_ADDED_WORDfileD }

check_that_building

There is always a space before opening bracket but it can be a situation that there will be not a space after opening bracket, there can a space before closing bracket but it's not always. Possible cases:

read build -old -f { fileX fileZ fileD }
read build -old -f {fileX fileZ fileD }
read build -old -f { fileX fileZ fileD}
read build -old -f {fileX fileZ fileD}

I'm writting the shell script that should process through some text, I've got the text like that:

read that { file1 file2 file3 }
check that { file2 file3 file4 }
read that { file4 file5 file6 }

I wanna to add some tekst before all files - that means words, that are included between brackets in 'read that' lines, what do you think is the best idea to achieve that? The results should look like that:

read that { MY_ADDED_WORDfile1 MY_ADDED_WORDfile2 MY_ADDED_WORDfile3 }
check that { file2 file3 file4 }
read that { MY_ADDED_WORDfile4 MY_ADDED_WORDfile5 MY_ADDED_WORDfile6 }

I was trying with greping that lines, next parsing it to array and concat this "file" strings with the word I wanna to add, but I think that is not a "smart" solution. Thanks for your help.

Input files look like this:

set build { file1 file2 file3 file4 }
check $build

read build -new -f $build
read build -new -f { fileA fileB fileC fileD }

set build {file5 file6 file7 }

read build -old -f $build
read build -old -f { fileX fileZ fileD }

check_that_building

I'm writting the shell script that should process through some text, I've got the text like that:

read build { file1 file2 file3 }
check build { file2 file3 file4 }
read build { file4 file5 file6 }

I wanna to add some text before all files - that means words, that are included between brackets in 'read build' lines, what do you think is the best idea to achieve that? The results should look like that:

read build { MY_ADDED_WORDfile1 MY_ADDED_WORDfile2 MY_ADDED_WORDfile3 }
check build { file2 file3 file4 }
read build { MY_ADDED_WORDfile4 MY_ADDED_WORDfile5 MY_ADDED_WORDfile6 }

I was trying with greping that lines, next parsing it to array and concat this "file" strings with the word I wanna to add, but I think that is not a "smart" solution. Thanks for your help.

Input files look like this:

set build { file1 file2 file3 file4 }
check $build

read build -new -f $build
read build -new -f { fileA fileB fileC fileD }

set build {file5 file6 file7 }

read build -old -f $build
read build -old -f { fileX fileZ fileD }

check_that_building

Output should look like that:

set build { file1 file2 file3 file4 }
check $build

read build -new -f $build
read build -new -f { MY_ADDED_WORDfileA MY_ADDED_WORDfileB MY_ADDED_WORDfileC MY_ADDED_WORDfileD }

set build {file5 file6 file7 }

read build -old -f $build
read build -old -f { MY_ADDED_WORDfileX MY_ADDED_WORDfileZ MY_ADDED_WORDfileD }

check_that_building

There is always a space before opening bracket but it can be a situation that there will be not a space after opening bracket, there can a space before closing bracket but it's not always. Possible cases:

read build -old -f { fileX fileZ fileD }
read build -old -f {fileX fileZ fileD }
read build -old -f { fileX fileZ fileD}
read build -old -f {fileX fileZ fileD}
added 337 characters in body
Source Link

I'm writting the shell script that should process through some text, I've got the text like that:

read that { file1 file2 file3 }
check that { file2 file3 file4 }
read that { file4 file5 file6 }

I wanna to add some tekst before all files - that means words, that are included between brackets in 'read that' lines, what do you think is the best idea to achieve that? The results should look like that:

read that { MY_ADDED_WORDfile1 MY_ADDED_WORDfile2 MY_ADDED_WORDfile3 }
check that { file2 file3 file4 }
read that { MY_ADDED_WORDfile4 MY_ADDED_WORDfile5 MY_ADDED_WORDfile6 }

I was trying with greping that lines, next parsing it to array and concat this "file" strings with the word I wanna to add, but I think that is not a "smart" solution. Thanks for your help.

Input files look like this:

set build { file1 file2 file3 file4 }
check $build

read build -new -f $build
read build -new -f { fileA fileB fileC fileD }

set build {file5 file6 file7 }

read build -old -f $build
read build -old -f { fileX fileZ fileD }

check_that_building

I'm writting the shell script that should process through some text, I've got the text like that:

read that { file1 file2 file3 }
check that { file2 file3 file4 }
read that { file4 file5 file6 }

I wanna to add some tekst before all files - that means words, that are included between brackets in 'read that' lines, what do you think is the best idea to achieve that? The results should look like that:

read that { MY_ADDED_WORDfile1 MY_ADDED_WORDfile2 MY_ADDED_WORDfile3 }
check that { file2 file3 file4 }
read that { MY_ADDED_WORDfile4 MY_ADDED_WORDfile5 MY_ADDED_WORDfile6 }

I was trying with greping that lines, next parsing it to array and concat this "file" strings with the word I wanna to add, but I think that is not a "smart" solution. Thanks for your help.

I'm writting the shell script that should process through some text, I've got the text like that:

read that { file1 file2 file3 }
check that { file2 file3 file4 }
read that { file4 file5 file6 }

I wanna to add some tekst before all files - that means words, that are included between brackets in 'read that' lines, what do you think is the best idea to achieve that? The results should look like that:

read that { MY_ADDED_WORDfile1 MY_ADDED_WORDfile2 MY_ADDED_WORDfile3 }
check that { file2 file3 file4 }
read that { MY_ADDED_WORDfile4 MY_ADDED_WORDfile5 MY_ADDED_WORDfile6 }

I was trying with greping that lines, next parsing it to array and concat this "file" strings with the word I wanna to add, but I think that is not a "smart" solution. Thanks for your help.

Input files look like this:

set build { file1 file2 file3 file4 }
check $build

read build -new -f $build
read build -new -f { fileA fileB fileC fileD }

set build {file5 file6 file7 }

read build -old -f $build
read build -old -f { fileX fileZ fileD }

check_that_building
Source Link
Loading