cat > /home/cloudera/input.csv

# paste the following text

hello world
hello pig
pig script pig

# press ctrl + d to save

cat /home/cloudera/input.csv

pig -x local

lines = LOAD '/home/cloudera/input.csv' AS (line:chararray);
words = FOREACH lines GENERATE FLATTEN(TOKENIZE(line)) AS word;
grouped = GROUP words BY word;
wordcount = FOREACH grouped GENERATE group, COUNT(words);

DUMP wordcount;

fs -ls

clear
history
exit

cat > /home/cloudera/student_data.txt

# paste the following text

1,John,Doe,NewYork
2,Alice,Smith,Chicago
3,Bob,Johnson,Dallas
4,Rahul,Sharma,Mumbai

# press ctrl + d to save

cat /home/cloudera/student_data.txt

pig -x local

sd = LOAD '/home/cloudera/student_data.txt'
USING PigStorage(',')
AS (id:int, firstname:chararray, lastname:chararray, city:chararray);

DESCRIBE sd;

DUMP sd;

EXPLAIN sd;
