I am writing an awk statement, and need to hold a variable for use until that variable is updated.
Sample data and file - *actual is medical data so can not post
GCAR101 red fast leather
1 3.2 l engine
2 black tires
3 tinted windows
cTrr-02 green slow leather
1 1.4 l enging
2rust
4tR34-1 blue fast no leather
1 no rust
I am trying to create an awk command that will hold a pattern $0 if the length($1)=7, and then put that variable in front of each individual description. Variable should update at each new 7 length first field
Should look like this:
GCAR101 red fast leather ; 1 3.2 l engine
GCAR101 red fast leather ; 2 black tires
GCAR101 red fast leather ; 3 tinted windows
cTrr-02 green slow leather ; 1 1.4 l enging
cTrr-02 green slow leather ; 2 rust
4tR34-1 blue fast no leather ; 1 no rust
Anyone have a suggestion? Trying to a void a loop with test statements as the file is quite large.
Thanks in advance.
Andy