Tag Archives: Last Name

Display the First and Last name from a file using shell scripting

By jakemathew

I am new to shell scripting and doing a similar thing @ work

Stan:Smith:Detroit:MI
Jim:Jones:Farmington Hills:MI
Jack:Frost:Denver:CO
Sue:Apple:New York:NY
Cindy:Thompson:Battle Creek:MI
John:Smith:Denver:CO
George:Jones:New York:NY

Need to create a shell script This script will display the following information in a menu format:
L – Print Last Names
F – Print First Names
C – Print First Name, Last Name sorted by city
S – Print First Name, Last Name, State sorted by state
Q – Exit the program

The script will perform all of the actions listed above on your file and loop until Q key is pressed.

I did the below but not working…

Code:
loop=y
while [ “$loop” = y ]
do
clear
tput cup 3 12; echo “P – Print Last Name”
tput cup 10 9; echo “Q – Quit: “
tput cup 10 19;
read choice || continue
case $choice in
[Pp]) less ~/export/home/mathews/homework2;;
[Qq]) exit ;;
*) tput cup 14 4; echo “Invalid Code”; read choice ;;
esac
done

Please help

…read more

Source: FULL ARTICLE at The UNIX and Linux Forums

Tru to print the last name and first name using key word

By jakemathew

I am new to shell scripting and trying to do the below

Stan:Smith:Detroit:MI
Jim:Jones:Farmington Hills:MI
Jack:Frost:Denver:CO
Sue:Apple:New York:NY
Cindy:Thompson:Battle Creek:MI
John:Smith:Denver:CO
George:Jones:New York:NY

Need to create a shell script This script will display the following information in a menu format:
L – Print Last Names
F – Print First Names
C – Print First Name, Last Name sorted by city
S – Print First Name, Last Name, State sorted by state
Q – Exit the program
The script will perform all of the actions listed above on your file and loop until Q key is pressed.

…read more

Source: FULL ARTICLE at The UNIX and Linux Forums

Shell script not working accordingly

By Akhilaprabhakar

loop=y
while [ “$loop” = y ]
do
clear
tput cup 5 15
echo -n “People Database”
echo -n “====================================”
tput cup 8 12
echo -n “L-Print Last Names”
tput cup 9 12
echo -n “F-Print First NAmes”
tput cup 10 12
echo -n “C-Print First Name, Last Name sorted by city”
tput cup 11 12
echo -n “S-Print First Name, Last Name, State sorted by state”
tput cup 12 12
echo -n “Q-Exit the program : “
tput cup 12 32
read value || Continue
case “$value” in
[Ll]) ./lastnames ;;
[Ff]) ./firstnames ;;
[Cc]) ./sort_city ;;
[Ss]) ./sort_state ;;
[Qq]) exit ;;
*) tput cup 14 4 ; echo “Invalid choice”; read value ;;
esac
done

When i try to execute this the case l,f,c and s donot execute corresponding scripts… only case Q works fine… All other scripts are executed when directly run from command prompt… What am i missing?

…read more

Source: FULL ARTICLE at The UNIX and Linux Forums

Dynamically added text fields passed to PHP script

By GroveTuckey

If I am posting this to the wrong section please move it somewhere it fits. I apologize if this is not the correct section.

I have a site where I want to have form that in a “Visitor name” section to be able to add fieldets as needed. I think I have that worked out.

So the below code is the text area boxes. There is a First Name, Last Name and a Job Title field.

Code:

Visitor Name


and the js code to recreate the fieldset is

Code:

var _counter = 0;
function Add() {
_counter++;
var oClone = document.getElementById("addmore").cloneNode(true);
oClone.id += (_counter + "");
document.getElementById("placeholder").appendChild(oClone);
}


That creates the fields when the “Add Visitor” button is pushed with no limit to the amount of dynamic fileds that can be created. It basically just copies the fieldset.

So I guess the PHP part is where I am getting hung up.

How do I pass those dynamic values into the php script and place them in a file.

When I use

Code:

foreach($_POST['name'] as $info) {
fwrite($file, "$companyname,$info,$boxes,$boxes1,$boxes2,$boxes3,$boxes4,$boxes5,$boxes6,$boxes7,$boxes8,$boxes9,$boxes10,$boxes11 n");
}


I get

Code:

Company,Fred,No,No,No,No,Yes,No,No,No,No,Yes,No,Yes
Company,Williams,No,No,No,No,Yes,No,No,No,No,Yes,No,Yes
Company,Hello,No,No,No,No,Yes,No,No,No,No,Yes,No,Yes
Company,Todd,No,No,No,No,Yes,No,No,No,No,Yes,No,Yes
Company,Williams,No,No,No,No,Yes,No,No,No,No,Yes,No,Yes
Company,Hello,No,No,No,No,Yes,No,No,No,No,Yes,No,Yes


Instead of

Code:

Company,Fred,Williams,Hello,No,No,No,No,Yes,No,No,No,No,Yes,No,Yes
Company,Todd,Williams,Hello,No,No,No,No,Yes,No,No,No,No,Yes,No,Yes


So I guess I am getting the data but I need it put in the above format. I assume …read more
Source: FULL ARTICLE at The UNIX and Linux Forums

awk help: Match data fields from 2 files & output results from both into 1 file

I need to take 2 input files and create 1 output based on matches from each file. I am looking to match field #1 in both files (Userid) and create an output file that will be a combination of fields from
both file1 and file2 if there are any differences in the fields 2,3,4,5,or 6.

Below is an example of where in file2 the First Name=John, Email=john.doe@yahoo.com, and Phone Number=111-222-3333.
Since these fields are different than the values in file1 I need the output in file3 based on the example below using awk. Any help would be greatly appreciated.

file1:

Code:
jdoe|Doe|Johnny|111-222-9999|jdoe@gmail.com|Main Office|1020-771-AHSDEV100|512
1|Userid
2|Last Name
3|First Name
4|Phone Number
5|Email
6|Office
7|Description
8|Account
file2:

Code:
jdoe|Doe|John|111-222-3333|john.doe@yahoo.com|Main Office|0xF48F9F97AB1E9242A6CCB96BA1DB5C79|0x820A4CE019D51F45B7B911CDCDB5208D|Data1|Data2|Data3|Data4|Data5|Data6|0
1|Userid
2|Last Name
3|First Name
4|Phone Number
5|Email
6|Office
7|Office Location
8|Contact UUID
9|Data1
10|Data2
11|Data3
12|Data4
13|Data5
14|Data6
15|Active

file3:

Code:
{ “820A4CE019D51F45B7B911CDCDB5208D”, “Doe”, “Johnny”, “111-222-9999”, “jdoe@gmail.com”, “jdoe”, “F48F9F97AB1E9242A6CCB96BA1DB5C79”, “Data1”, “0” }

{
“file2 field #8 (Office Location) cut -c3-34″
“file1 field #2 (Last Name)”
“file1 field #3 (First Name)”
“file1 field #4 (Phone Number)”
“file1 field #5 (Email)”
“file1 field #1 (Userid)”
“file2 field #7 (Office Location) cut -c3-34″
“file2 field #9 (Data1)
“file2 field #15 (Active)”

Moderator’s Comments:

Please use code tags when posting data and code samples!

Source: The UNIX and Linux Forums