cut command not found


 
Thread Tools Search this Thread
Operating Systems Linux Ubuntu cut command not found
# 1  
Old 04-04-2012
cut command not found

I am trying to sort the contents of "list.txt" based on the order matching keywords appear in "keywords.txt". I am getting this error:

root@ubuntu:~/Desktop/sort# bash script.bsh
cut: script.bsh: line 1: $: command not found
invalid byte or field list
Try `cut --help' for more information.

bash code:

Code:
$ join -1 2 -2 1 <(cat -n keywords.txt | sort -k2) <(sort list.txt) | sort -k2,2n | cut -d ' ' -f 1,3-

I even tried this:

Code:
$ join -1 2 -2 1 <(cat -n keywords.txt | sort -k2) <(sort list.txt) | sort -k2,2n | /usr/bin/cut -d ' ' -f 1,3-

Moderator's Comments:
Mod Comment Code tags for code, please.

Last edited by Corona688; 04-04-2012 at 03:06 PM..
# 2  
Old 04-04-2012
Is that $ in your script, or just a command prompt? If it is in the script, remove it.
# 3  
Old 04-04-2012
I removed it.

script:

Code:
join -1 2 -2 1 <(cat -n keywords.txt | sort -k2) <(sort list.txt) | sort -k2,2n | cut -d ' ' -f 1,3-

error:

Code:
root@ubuntu:~/Desktop/sort# bash script.bsh
cut: invalid byte or field list
Try `cut --help' for more information.


Last edited by DukeNuke2; 04-04-2012 at 04:23 PM..
# 4  
Old 04-04-2012
Did you edit this script in notepad? That will have filled it with garbage carriage returns that will mung up the operations of many commands.

Code:
tr -d '\r' < wingarbage > fixed

# 5  
Old 04-04-2012
I made it in notepad++ and I also ran that code on it...same error.

Last edited by DukeNuke2; 04-04-2012 at 04:48 PM..
# 6  
Old 04-04-2012
That command generates a new file. You have to run the new file.

Or better yet, just generate the script in UNIX in the first place. It has plenty of its own text editors. Install nano if you want something friendly to those new to it, or vi if you want to learn the de-facto standard.
This User Gave Thanks to Corona688 For This Post:
# 7  
Old 04-04-2012
this worked. thank you!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Cut command: can't make it cut fields

I'm a complete beginner in UNIX (and not a computer science student either), just undergoing a tutoring course. Trying to replicate the instructions on my own I directed output of the ls listing command (lists all files of my home directory ) to My_dir.tsv file (see the screenshot) to make use of... (9 Replies)
Discussion started by: scrutinizerix
9 Replies

2. Shell Programming and Scripting

C command not found

Dear All, I am trying to install a program in Opensuse linux and while issuing the 'make' command, its showing me an error /bin/sh: C: command not found Kindly help me to troubleshoot the problem. I have gcc, c++ all install in the linux machine. Thanks (9 Replies)
Discussion started by: biochemist
9 Replies

3. UNIX for Dummies Questions & Answers

Cut pid from ps using cut command

hay i am trying to get JUST the PID from the ps command. my command line is: ps -ef | grep "mintty" | cut -d' ' -f2 but i get an empty line. i assume that the delimiter is not just one space character, but can't figure out what should i do in order to do that. i know i can use awk or cut... (8 Replies)
Discussion started by: ran ber
8 Replies

4. Shell Programming and Scripting

Want to terminate command execution when string found in the command output

Hi Experts, I am very much new to linux scripting, I am currently working on reducing my manual work and hence writing a script to automate few task. I am running below command to snmpwalk the router.. snmpwalk -v 3 -u WANDL_SU -a MD5 -A vfipmpls -x DES -X VfIpMpLs -l authPriv... (19 Replies)
Discussion started by: Hanumant.madane
19 Replies

5. Shell Programming and Scripting

When i am trying to execute export command within a shell script it is saying command not found.

I am running the export command within a view to use that value inside my build script. But while executing it it is saying "export command not found" My code is as follows: -------------------------- #!/bin/sh user="test" DIR="/bldtmp/"$user VIEW="test.view1" echo "TMPDIR before export... (4 Replies)
Discussion started by: dchoudhury
4 Replies

6. Shell Programming and Scripting

bash: <command nm> command not found

I created a script that I need to run from time to time, but get this error message. To get it working again I run this command from time to time: export PATH="$PATH:~/scripts" I put all my automated scripts in the /scripts directory and would like to run my scripts from any directory... (5 Replies)
Discussion started by: catalinawinemxr
5 Replies

7. Shell Programming and Scripting

Cut Command error cut: Bad range

Hi Can anyone what I am doing wrong while using cut command. for f in *.log do logfilename=$f Log "Log file Name: $logfilename" logfile1=`basename $logfilename .log` flength=${#logfile1} Log "file length $flength" from_length=$(($flength - 15)) Log "from... (2 Replies)
Discussion started by: dgmm
2 Replies

8. Shell Programming and Scripting

cut - command not found

Hi, i was writing a script (in csh) and encountered this problem ... echo - n "enter month:" set month = $< echo `$month | cut -c1` the output was " Jan: Command not found" i also tried using /usr/bin/cut instead of cut only, but same problem i also checked my path and /usr/bin/ is... (4 Replies)
Discussion started by: solidhelix08
4 Replies

9. Shell Programming and Scripting

how can i check in csh if command found or not found ?

hello all im trying to use in sun Solaris the information received from the top command now i several machines that dont have install the top program so when im running the script im geting error saying after im running this code : set MemoryInfo = `top | grep Memory` if (... (2 Replies)
Discussion started by: umen
2 Replies

10. UNIX for Advanced & Expert Users

command not found

Dear all, I made a FDTD code (in fortran) and i run it on the supercomputer (NEC SX-6) which is unix based. now here is the problem, if i run small program it runs without problem, but if i increase the size of the program (but exactly the same code I get the message "command not found". i was... (1 Reply)
Discussion started by: simba_tsavo
1 Replies
Login or Register to Ask a Question