hi All,
Below is the output of my script, I want to put all this in 1 line, but it is not writing in 1 single line even after concatenate it.
File Name
2
Milage 30:29.50
START TIME - 21SEP23:23:22:52
END TIME - 21SEP23:23:31:52
0:39:41.23
Initial_check1_Project_f91bcd93-21ea-4263-bde4-740268288333
I have tried below code but no luck,
</start>
Name=File Name
count=2
Mileage=Mileage 30:29.50
Time1=START TIME - 21SEP23:23:22:52
Time2=END TIME - 21SEP23:23:31:52
Duration=0:39:41.23
id=Initial_check1_Project_f91bcd93-21ea-4263-bde4-740268288333
Final="$Name $count $Mileage $Time1 $Time2 $Duration $id"
</end>
Please use code tags for your code and data, I did it for this time...
You say you tried below code but I see none... I thought the idea of catenate was you were here trying to merge 2 files, the first with the name of variable you would find in the second...
I don't understand how the output is produced, but since I see no code...
Please also reply at the previous post, and suggest greatly you look at the hint.
script is reading 1 log file, from which I have grepped few key words, and out out is as below after storing all values in some variable,
File Name
2
Milage 30:29.50
START TIME - 21SEP23:23:22:52
END TIME - 21SEP23:23:31:52
0:39:41.23
Initial_check1_Project_f91bcd93-21ea-4263-bde4-740268288333
Now I want to write all the above content in 1 line in another file.
for that I wrote code,
'Name=File Name'
'count=2'
'Mileage=Mileage 30:29.50'
'Time1=START TIME - 21SEP23:23:22:52'
'Time2=END TIME - 21SEP23:23:31:52'
'Duration=0:39:41.23'
'id=Initial_check1_Project_f91bcd93-21ea-4263-bde4-740268288333'
File Name
2
Mileage 30:29.50
START TIME - 21SEP23:23:22:52
END TIME - 21SEP23:23:31:52
0:39:41.23
Initial_check1_Project_f91bcd93-21ea-4263-bde4-740268288333
and the first line of your for FILE in ....
SEGMENT=cat "$FILE" | grep -i "_seg_" | cut -d"=" -f2 | cut -d")" -f1
test.log: command not found
so, unless you've mistakenly posted something else ... you code does not / cannot work as is.
something along the following may work - dependant upon input ....
@deepu27,
what happens if you enable the set -x you commented out in your script?
Does this help you with the further troubleshooting?
As your script stands now (most likely improperly formatted in your post) has no chance to produce anything (but errors/warnings)...
I'd suggest to use the proper forum markdown code tags described here to provide what your actual code attempt looks like.
I have added triple-backticks to the beginning and end of your code. Now the backticks in your code are visible. Without the ' ' ticks it can make sense.
This does a concatenation; it is written to the result.csv file.
The following echo's print on separate lines; I guess it is for debugging?
Without seeing a sample log file it is impossible to say more from here.
The issue remains that you grep the input for the texts _seg_, Result summary, Price Range, price Range, CASLIBIN, and none of those pattern texts is present in your input file. So all your variables will remain empty, and thus your output will also be empty.