i'm trying to remove the lines containing literal ,32, and the line BEFORE/ABOVE it that should always contain ,34,
files example:
dd,34,dd 10:00 game1
dd,32,dd 10:01 game1
dd,34,dd 12:30 game2
dd,31,dd 12:32 game2
dd,34,dd 13:54 game3
dd,31,dd 13:55 game3
dd,34,dd 15:00 game1
dd,32,dd 15:00 game1
#note: there's a few thousand of these lines in the file
I've tried using grep
grep -v -B1 ',32,'
file1 > file2
file2 should be all lines from file1 except for the lines containing ,32, and the line before ,32, doesnt work as intented
sed "/\,32\,/,+1d" rp1 > rep2
sed "/\,32\,/,~1d" rp1 > rep2
deletes lines in a different order than intended. The amounts of lines containing ,34, match the lines containing the rest of the symbols. As if it deletes the ,32, line and the line AFTER instead of BEOFRE.
OUTPUT AFTER USING SED command from above:
dd,34,dd 10:00 game1
dd,31,dd 12:32 game2
dd,34,dd 13:54 game3
dd,31,dd 13:55 game3
dd,34,dd 15:00 game1
DESIRED OUTPUT:
dd,34,dd 12:30 game2
dd,31,dd 12:32 game2
dd,34,dd 13:54 game3
dd,31,dd 13:55 game3