0

Does anyone know how could i to write a shell script that reads in a text file (i.e.tests.txt) as an input and then process it and saves the results on another file (i.e.cleantabletests.txt)

for example:

input tests.txt contains the following:

your test with name="firstTest" has finished succesfully but results="failed"
your test with name="secondTest" has finished successfully but results="passed"
your test with name="thirdTest" has finished successfully but results="passed"

process: use a shell script to read the tests.txt and process it to output the results in this cleantabletests.txt

output after tests.txt was processed cleantabletests.txt should look like this:

1, name="firstTest", results="failed"
2, name="secondTest", results="passed"
3, name="thirdTest", results="passed"

i am only interested in the names and results to use them to create a table afterwards

3
  • 1
    We encourage questioners to show what they have tried so far to solve the problem themselves. Commented Mar 5, 2022 at 20:33
  • ...so, f/e, if you showed code that demonstrated that you already knew about and were trying to use the techniques taught by the linked duplicates, but were having a problem in applying those techniques, that would allow an answer distinct from the ones already given on those preexisting questions, because it would make your question more distinct and narrow. Commented Mar 5, 2022 at 20:41
  • the issue is i am not very well versed in bash scripting and what i am trying to do is this: [i=0] ; for every line do { if [name=[.]* && result=[.]*] { NAME="name=[.]*" && RESULT="result=[.]*" && NUMBER=i; echo NUMBER NAME RESULT >> cleantablestests.txt; i++;}} if no more lines [quit] sorry for my crude syntax Commented Mar 13, 2022 at 15:37

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.