Find the answer to your Linux question:
Results 1 to 5 of 5
I have tried to find a way to correct a problem I am having with a file being written. I write the file using these commands: Code: gawk -F"\t" '{ ...
  1. #1
    Just Joined!
    Join Date
    Oct 2007
    Location
    Houston
    Posts
    75

    Replace remove white spaces after a tab

    I have tried to find a way to correct a problem I am having with a file being written. I write the file using these commands:

    Code:
    gawk -F"\t" '{ print $2"\t" $3"\t" | "sort" }' backupsets > bset1
    awk NF bset2 > bset3
    sed /"ACCT #"/d bset3 >bset4
    sed /"800-000-0000"/d bset4 >bset5
    sed /"713-000-0000"/d bset5 > bset6
    tr '[a-z]' '[A-Z]' < bset6 > cbset
    sed 's/^ //g' cbset >cbset1
    rm -rf bset*
    Instead of getting tabs I get a tab with a few spaces. I want to remove the space. I have tried different sed strings to get this done but it still does not work. Any thoughts?

  2. #2
    Linux User
    Join Date
    Aug 2006
    Posts
    458
    you don't need to use that much *nix tools ..as always, show your input and describe your output.

  3. #3
    Just Joined!
    Join Date
    Oct 2007
    Location
    Houston
    Posts
    75
    When I am done with that top part the file looks like

    Code:
    ACC006000AK     WWW1\FILES ON C$,SYSTEM STATE AND SERVICES DATABASE\ADMIN001
    ACC006000AK     WWW1\MICROSOFT SQL SERVER\ADMIN001
    ACC006000AK     WWW2\FILES ON C$,SYSTEM STATE AND SERVICES DATABASE\ADMIN002
    ACC006000AK     WWW2\MICROSOFT SQL SERVER\ADMIN001
    ACC006000DG     MYSQL\192.168.100.120\INFORMATION_SCHEMA, LAVA, MYSQL\ADROOT
    ACC006000DG     UNIX-SSH\172.16.40.53\/*\ADROOT
    Instead of the spaces from ACC00600AK and DG it should be a tab then the last part.

  4. #4
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    This isn't very helpful, since posting it on the forum removes tabs.

    Show us what the original file (before you did anything) looks like, describe it in words (so we don't miss anything), and then do the same to what the final result should be.
    DISTRO=Arch
    Registered Linux User #388732

  5. #5
    Linux Enthusiast apoorv_khurasia's Avatar
    Join Date
    Feb 2005
    Location
    Laurasia
    Posts
    624
    Are you trying to replace white spaces to get tabs? And as Cabhan said attach files (input.txt and desired_output.txt).
    "There is no sixth rule"
    --Rob Pike
    Registered Linux User: 400426 home page

Posting Permissions

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