Thread: cut command wont work in shell??

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    40

    Question cut command wont work in shell??

    --------------------------------------------------------------------------------

    hi,

    on linux command promt cut command work.
    but the same command gives empty output in linus shell?

    please help

    F1=$(echo $line | cut -s -f26) NOT working in shell

    cat file | cut -s -f26 work!

  2. #2
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Since there is no such thing as the "linus shell", you will have to explain what you are actually referring to.

    The command line IS the bash shell; when you refer to the "linux command prompt" you are really talking about the bash shell. It is unlikely that there is any other shell on your system, so saying something "works from the command prompt" but "not from the shell" does not make any sense: they are the same thing. It would be like if you had a red car parked outside and someone said "the bag is in your car, but not in the red car parked outside".
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  3. #3
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065
    You'll have to try this in steps. When you are debugging a Bash script, it is helpful to echo the variables prior to the command that is failing. Most likely your variable doesn't have what you think it has.

    Also, it would be very helpful to know what line has and what you are attempting to do with cut.

  4. #4
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    If this is a shell script, post some context.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to make a new shell
    By thebiggestbang in forum Linux Programming
    Replies: 5
    Last Post: 08-15-2009, 10:45 AM
  2. Replies: 34
    Last Post: 05-27-2009, 12:26 PM
  3. getline() don't want to work anymore...
    By mikahell in forum C++ Programming
    Replies: 7
    Last Post: 07-31-2006, 10:50 AM
  4. Why don't the tutorials on this site work on my computer?
    By jsrig88 in forum C++ Programming
    Replies: 3
    Last Post: 05-15-2006, 10:39 PM