-1

I have a file in my unix machine which contains some number of lines like below,

 6024|OH|MIDDLEBURG HEIGHTS|MIDDLEBURG HEIGHTS|6925 SOUTHLAND DRIVE||1|44130|4408840505|8-9|9-9|11-6|
 6025|OH|NORTH OLMSTED|NORTH OLMSTED|26035 LORAIN ROAD ||1|44070|4407342180|8-9|9-9|11-6|
 6026|MI|MADISON HEIGHTS|MADISON HEIGHTS|32251 JOHN R. ||1|48071|2485858880|8-9|9-9|10-6|
 6027|NY|AMHERST|AMHERST|4224 MAPLE ROAD ||1|14226|7168626660|8-9|9-9|11-6|
 6028|MI|KENTWOOD|KENTWOOD|4160 28TH STREET S.E. ||2|49512|6169565555|8-9|9-8|10-6|
 6029|PA|ERIE|ERIE|905 MILLCREEK MALL ||1|16565|8148684100|8-9|9-9|11-6|
 6030|OH|AKRON|AKRON|37 N. CLEVE.-MASSILLON RD ||1|44333|3306664550|8-9|9-8|11-6|
 6031|OH|HOLLAND|HOLLAND|6520 CENTERS DRIVE ||1|43528|4198672925|8-9|9-9|11-6|
 6032|MI|STERLING HEIGHTS|STERLING HEIGHTS|37600 VAN DYKE ||1|48312|5868263767|8-9|9-9|10-6|
 6033|NY|COLONIE|COLONIE|1814 CENTRAL AVENUE ||1|12205|5184523371|8-9|9-9|10-6|
 6034|NY|ROCHESTER|ROCHESTER|3333 WEST HENRIETTA ROAD ||1|14623|5852920660|8-9|9-9|11-6|
 6036|WI|MILWAUKEE|MILWAUKEE|9088 N. GREEN BAY ROAD ||1|53209|4143628000|8-9|9-8|10-6|

In this, I want to replace the 7 th pipe delimited field value to 3, only for certain 8th delimited field value.

I have tried like this,

   awk -F\| '{print $7,$8}'  Load_Jira3665_OffDepot.txt_bak | egrep 23454|23113|63011|63011|53072|55369|00969|50266|78130'  | awk '{print $1}' | sed s/2/3/g

But this just replaces on the output screen and the changes didn't take effect in the original file. How could I achieve this?

choroba
  • 231,213
  • 25
  • 204
  • 289
Vishnu J
  • 89
  • 1
  • 8

1 Answers1

1

To transfer the output on the screen to a file use > after your unix command followed by the file name that you want to transfer the output to. check this link for more: Redirect all output to file

Community
  • 1
  • 1
Raj
  • 35
  • 1
  • 9