LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-10-2011, 05:50 PM   #1
thebeav
LQ Newbie
 
Registered: Jan 2011
Posts: 25

Rep: Reputation: 1
Stuck on join command from book


Hello,

Going through book, "Guide to UNIX Using Linux". I am doing one of the projects that has me writing scripts to join files. Here is my pnumname script and I am extracting the programmers names and numbers from the program file and redirecting the output to the file pnn. I then created a joinall script where I am trying to join the files pnn and pnumname and redirect the output to pactrep. When I run the script sh joinall and use less to display the contents of the redirected file pactrep, I get an error- join: extra operand `pnum'
Try `join --help' for more information....
I went to the man pages but I still (obvious) do not have a solid grasp. Thanks for the help in advance.

#=======================================================
# Script Name: pnumname
# By: J.D.
# Date: February 2011
# Purpose: Extract Programmer Numbers and Names
#=======================================================
cut -d: -f1-4 programmer | sort -t: -k 1 | uniq > pnn
# The above cuts out fields 1 through 4.
# The output is piped to a sort by programmer number.
# The sorted output is piped to uniq to remove
# duplicates.
# Uniq redirects the output to pnn.

output file pnn results...

cat pnn
101:Johnson:John:K
102:King:Mary:K
103:Brown:Gretchen:K
104:Adams:Betty:C
105:Utley:Amos:V
106:Wilson:Patricia:B
107:Culligan:Thomas:F
108:Mitchell:Hillary:N
109:Arbuckle:Margaret:F
110:Ford:Terrence:H
111:Greene:Sarah:L
112:Rose:Richard:P
113aniels:Allan:S
114:Edwards:George:J

joinall script

#=========================================================
# Script Name: joinall
# By: J.D.
# Date: February 2011
# Purpose: Join pnum and pnn to create a report file
#==========================================================
# Join the file including the unassigned programmers.
# You do this by placing the programmer names (pnn) file,
# forst, in the join sequence.
#==========================================================
join -t: a1 -j1 1 -j2 1 pnn pnum > pactrep

Last edited by thebeav; 02-10-2011 at 05:56 PM.
 
Old 02-11-2011, 10:23 AM   #2
thebeav
LQ Newbie
 
Registered: Jan 2011
Posts: 25

Original Poster
Rep: Reputation: 1
I solved it, I am so stupid sometimes. -a1 , I forgot to minus
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
i need some join command help? DaDead Linux - Newbie 3 10-31-2009 04:00 PM
LFS newbie stuck in Linux API headers step 5.5 LFS book 6.3 Vxplus Linux From Scratch 2 11-10-2008 09:13 PM
join command error UnixKiwi Programming 12 01-23-2008 12:36 AM
Unable to join domain using Net Join command in FC3 client jeb083079 Linux - Networking 9 07-30-2007 03:41 AM
net join ads command Steve1445 Linux - Networking 4 02-25-2005 08:44 AM


All times are GMT -5. The time now is 04:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration