Saturday, May 11, 2013

cut Command in Unix

The cut command takes a vertical slice of a file, printing only the specified columns or fields
delimiter tab : ctrl+v TAB,: etc
    syntax : cut [option] file
 option:
    -c character
    -f  field
    -d delimiter

Example:
cut -c1-6 company.data        #to print just char 1 to 6 of each line

cut -c4,8 company.data        # to print just char 4 and 8 of each line

cut -d: -f3 company.data       #to print the columns 3 by using the delimiter of the line(:)

cut –d: -f3- company.data    #to print the columns 3 to END



No comments:

Post a Comment

Oracle EBS R12 – Query to View Consolidated Invoice Details with Individual Transactions

SELECT     hp.party_name                  AS customer_name,     aca.account_number             AS customer_account,     hci.cons_billing_num...