Trouble with simple cutting, joining


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Trouble with simple cutting, joining
# 1  
Old 02-12-2016
Trouble with simple cutting, joining

Made a file called assignment1.sh and this is what's inside -
Code:
#!/bin/bash
$ cut -c 2 sales.txt > regionalsales.txt
$ cut -c 6 sales.txt > regionalsales.txt
$ cut -c 1 territory.txt > terrsummary.txt
$ cut -c 2 territory.txt > terrsummary.txt
$ cut -c 3 territory.txt > terrsummary.txt
$ sort -n 4 names.txt > sortnames.txt
$ sort -n 1 regionalsales.txt > sortsales.txt
$ sort -n 1 terrsummary.txt > sortsummary.txt
$ join sortsales.txt sortsummary.txt > allsales.txt
$ join allsales.txt sortnames.txt > finalfile.txt

I have a file named sales.txt, territory.txt and names.txt. The others are to be created. I'm getting this when I run in terminal -

Code:
[dylanrukav@localhost Assignment1]$ '/home/dylanrukav/Desktop/Assignment1/assignment1' 
/home/dylanrukav/Desktop/Assignment1/assignment1: line 2: $: command not found
/home/dylanrukav/Desktop/Assignment1/assignment1: line 3: $: command not found
/home/dylanrukav/Desktop/Assignment1/assignment1: line 4: $: command not found
/home/dylanrukav/Desktop/Assignment1/assignment1: line 5: $: command not found
/home/dylanrukav/Desktop/Assignment1/assignment1: line 6: $: command not found
/home/dylanrukav/Desktop/Assignment1/assignment1: line 7: $: command not found
/home/dylanrukav/Desktop/Assignment1/assignment1: line 8: $: command not found
/home/dylanrukav/Desktop/Assignment1/assignment1: line 9: $: command not found
/home/dylanrukav/Desktop/Assignment1/assignment1: line 10: $: command not found
/home/dylanrukav/Desktop/Assignment1/assignment1: line 11: $: command not found
[dylanrukav@localhost Assignment1]$

Any ideas?

Edit - I'm using CentOS with GNOME desktop.
# 2  
Old 02-12-2016
Moderator's Comments:
Mod Comment Homework assignments must be posted in the Homework & Coursework forum and must include a completely filled out template from the special homework and coursework rules page pointed to by the infraction notice you received in your e-mail a little while ago.

This thread is closed.

Please repost your question in the proper forum with the required template.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

[Solved] Having trouble with simple grep search

I have a text file (allWords.txt), that I would like to search through. Here is a snippet of what it looks like... a aah aahed aahing aahs aardvark aardvarks aardwolf ab abaci aback abacus abacuses abaft ...... I would like to use the grep search to search, line by line, for... (8 Replies)
Discussion started by: blackvelvet
8 Replies

2. Red Hat

Syslog.conf: looking for a simple answer on a simple question

Cheers! In /etc/syslog.conf, if an error type is not specified, is it logged anywhere (most preferable is it logged to /var/log/messages) or not? To be more precise I am interested in error and critical level messages. At default these errors are not specified in syslog.conf, and I need to... (6 Replies)
Discussion started by: dr1zzt3r
6 Replies

3. Shell Programming and Scripting

Help making simple perl or bash script to create a simple matrix

Hello all! This is my first post and I'm very new to programming. I would like help creating a simple perl or bash script that I will be using in my work as a junior bioinformatician. Essentially, I would like to take a tab-delimted or .csv text with 3 columns and write them to a "3D" matrix: ... (16 Replies)
Discussion started by: torchij
16 Replies

4. UNIX for Dummies Questions & Answers

any script for joining files based on simple conditions

Condition1; If NPID and IndID of both input1 and input2 are same take all the vaues relevant to them and print together as output Condition2; IDNo in output: Take the highly repeated same letter of similar NPID-IndID as *1* Second highly repeated same letter... (0 Replies)
Discussion started by: stateperl
0 Replies

5. Shell Programming and Scripting

Cutting the value from a string

Hi all I have a string variable ${WHERE_SQL1} where i want to cut the first value of a variable. Eg ${WHERE_SQL1} = 'Where a.id =.................' I the string to be 'a.id =.......' Thanks in advance (2 Replies)
Discussion started by: theeights
2 Replies

6. Shell Programming and Scripting

Trouble cutting characters into a string.

I just have a couple of quick questions. I am having trouble with this cut. I am basically trying to cut the string so that i can insert the users guess at the appropriate point in the string. $letters is the character count of the $word. What it seems to do is cut the character into the... (0 Replies)
Discussion started by: Makaer
0 Replies

7. Shell Programming and Scripting

cutting lines

Dear All, Is there a way to cut the lines that have been "head" Here is what i m trying to do Please advice there is file name dummy.txt now i am trying to head this file 4 time by using a loop and every time this file is head with different values e.g in first instance it will... (7 Replies)
Discussion started by: jojo123
7 Replies

8. Shell Programming and Scripting

problem cutting

echo $line|cut -d " " -f`$plannedCount`- and this is the output $ ./read.sh ./read.sh: 12: not found JADE TRADER 143W MYPEN 40 HC M X10 28 7 1 0 ./read.sh: 9: not found MYPEN 20 GP X X10 15 2 1 0 ./read.sh: 9: not found MYPEN 40 GP X X10 28 7 1 0 ./read.sh: 9: not found MYPEN 20... (6 Replies)
Discussion started by: finalight
6 Replies

9. UNIX for Dummies Questions & Answers

cutting

Is there any cut or awk function that would allow me to take the last part of a path away and save the list into a file? I wrote: find $HOME -mtime +3 > fileList cat fileList /home/102/s/jn/folder/HW /home/102/s/jn/otherfolder/B.txt /home/102/s/jn/folder4/3dA/w... (1 Reply)
Discussion started by: terms5
1 Replies

10. Shell Programming and Scripting

cutting out the last field

Hi all; i was asked to install an inventory tool on our Reliant Unix 5.45 server. I downloaded the file from our intratnet. It was always failing when i try to install it. After some investigation i saw that the installation script had something strange. When i "cat <script>" i see nothing... (2 Replies)
Discussion started by: bcheaib
2 Replies
Login or Register to Ask a Question