Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I have a test.txt file with column (Serialnumber,value).

test.txt:

"SEQ_IN_AMT.NEXTVAL",123123
"SEQ_IN_AMT.NEXTVAL",123114

here SEQ_IN_AMT is a sequence name create on Oracle. Now, when I load this file through sqlldr in unix to Oracle db.i want the value of this sequence so that I will use this sequence value in below procedure:

P_UPDATE_VALUE (SEQ_IN_AMT.NEXTVAL,value) 
share|improve this question

1 Answer 1

To change the format of the file test.txt, use awk:

awk -F'[",]' '{printf "P_UPDATE_VALUE (%s,%s)\n",$2,$4}' test.txt

Prints:

P_UPDATE_VALUE (SEQ_IN_AMT.NEXTVAL,123123)
P_UPDATE_VALUE (SEQ_IN_AMT.NEXTVAL,123114)
  • -F defines the delmiters awk should use " and , in this case.
  • printf formats the output as desired
  • $2 and $4 are the both fields, based on the delimiters
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.