Reputation: 111
How to replace the below DECIMAL data type with DOUBLE using shell script?
Source String:
.
.
GROSS_AMOUNT DECIMAL(11, 2)
.
.
Result Should be:
.
.
GROSS_AMOUNT DOUBLE
.
.
Upvotes: 0
Views: 51
Reputation: 5318
From within shell script:
#!/bin/bash
str="...GROSS_AMOUNT DECIMAL(11, 2)..."
str=$(sed 's/DECIMAL(.*)/DOUBLE/' <<< $str)
echo $str
This will output: ...GROSS_AMOUNT DOUBLE...
Using sed
, replace DECIMAL(11, 2)
with whatever (in this case, DOUBLE
).
Upvotes: 0
Reputation:
awk 'BEGIN{FS=OFS=" "}$2{$2="DOUBLE"}1'
DOUBLE
Upvotes: 1