Hi folks,
I have a situation where i have a raw file like
cat file_raw
776 713 111
0776713113
317-713-114
235776713115
776713116
336713117
77 6 713 118
0776713119
235776713120
and would like to replace all leading zeros with 235, remove all spaces and dashes, and make all lines start with 235.
I have used the script below and works fine but would like to summarise it.
sed 's/^0//' file_raw > file_space
sed 's/ //g' file_space > file_lead7
sed 's/^7/2567/' file_lead7 > file_lead3
sed 's/^3/2563/' file_lead3 > file_dash
sed 's/-//g' file_dash > file_last
Expected output is
cat file_last
235776713111
235776713113
235317713114
235776713115
235776713116
235336713117
235776713118
235776713119
235776713120