Results 1 to 6 of 6

Thread: Cut command

  1. #1
    Join Date
    Jun 2009
    Posts
    272

    Unanswered: Cut command

    Kindly help me out in getting the desired output for a cut command

    For example this is how my file is

    specialcase
    grateful
    cricketplayers
    soccerteam

    From this file the cut command should only output the last 4 characters of each word. This should be my output

    case
    eful
    yers
    team

  2. #2
    Join Date
    Jun 2009
    Posts
    272
    Not only the cut command. If it is possible with any other command, that would be helpful.

  3. #3
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    substr('grateful',len(grateful)-4)

    HTH

    Sathyaram
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  4. #4
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    oops ... you can do right('grateful',4)

    cheers

    sathyaram
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  5. #5
    Join Date
    Jun 2009
    Posts
    272
    Thanks Satyaram. Your answer reflects to a single word. But I have a file named test

    this is how file looks like

    $cat test

    specialcase
    grateful
    cricketplayers
    soccerteam


    Now I need a command to execute on that file so that the output would be

    case
    eful
    yers
    team

  6. #6
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11

    cut

    this is a db2 forum and has nothing todo with cut command from linux/unix o/s
    check in the forum about shell command for that system.
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •