Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Increment Column having Alphanumeric value in file

$
0
0
I want to replace a column(first and last) having an alphanumeric value in a file.
Requirement :
1)All values in a Column must be unique and contain an incremented pattern “HCTV0096” for first column and “cafefeca0090” for last column
2)for uniquely identifying each value in column Numeric part must be incremented by 1 for both column

Output must be :
Code:

HDTV0092|Subcenre B| Sa_WSDSD |bocvdf| caddfdfefeca0090
HDTV0093|Subcenre B| Sa_WSDSD |bocvdf| caddfdfefeca0091
HDTV0094|Subcenre B| Sa_WSDSD |bocvdf| caddfdfefeca0092
HDTV0095|Subcenre B| Sa_WSDSD |bocvdf| caddfdfefeca0093
:
:

I have tried, and got below only for first column
Code:

awk -F '|' '{print "HDTV"$1+1,$0}' file1
but it gives :
Code:

HDTV1 HDTV0092|Subcenre B| Sa_WSDSD |bocvis|caddfdfefeca0090
HDTV1 HDTV0093|Subcenre B| Sa_WSDSD |bocvdf| caddfdfefeca0091
HDTV1 HDTV0094|Subcenre B| Sa_WSDSD |bocvdf| caddfdfefeca0092
HDTV1 HDTV0095|Subcenre B| Sa_WSDSD |bocvdf| caddfdfefeca0093

Kindly help me with this..:)

Viewing all articles
Browse latest Browse all 16232

Trending Articles