bash - Removing specific strings from strings in a file -
i want remove specific fields in strings in semi-colon delimited file.
the file looks :-
texta1;texta2;texta3;texta4;texta5;texta6;texta7 textb1;textb2;textb3;textb4;textb5;textb6;textb7 textc1;textc2;textc3;textc4;textc5;textc6;textc7 i remove positions 2, 5 , 7 strings in file.
desired output :-
texta1;texta3;texta4;texta6 textb1;textb3;textb4;textb6 textc1;textc3;textc4;textc6 i trying write small shell script using 'awk' code not working expected. still seeing semicolons in between & @ end not being removed.
(note- able 'sed' file has several hundred thousands of records & sed code taking lot of time)
could please provide on ? in advance.
most cut:
cut -d \; -f 1,3-4,6,8- filename or
cut -d \; -f 2,5,7 --complement filename i think --complement gnu-specific, though. 8- in first example not necessary file 7 columns; include columns eighth forward if existed. included because doesn't hurt , provides more general solution problem.
Comments
Post a Comment