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 113:Daniels: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 |
I solved it, I am so stupid sometimes. -a1 , I forgot to minus
|
All times are GMT -5. The time now is 03:44 PM. |