Commit f6cf7cda authored by DEEP KARKHANIS's avatar DEEP KARKHANIS

ADDED LAB2 FILES

parents
CodeGeeks
We have solved the 6 scripts and the extra questions and added the required files/pictures.
The contributions are as follows:
Script1 : 160100021 Pranav Rao
Script2 : 16D070017 Sriram Yenamandra
Script3 : 160100024 Deep Karkhanis
Script4 : 160100021 Pranav Rao
Script5 : 16D070017 Sriram Yenamandra
Script6 : 160100024 Deep Karkhanis
Extras : All have tried the exercises.
Outlab2-Bash 29-7-17
#!/bin/bash
function lineForm()
{
local teamName=$( echo $line | tr ' ' '<' | cut -d , -f 1 | tr '<' ' ')
iter=2
while [ 1 ]
do
local team_mem=$( echo $line | tr ' ' '<' | cut -d , -f $iter | tr '<' ' ')
(( iter++ ))
local team_mem_roll=$( echo $line | tr ' ' '<' | cut -d , -f $iter | tr '<' ' ')
(( iter++ ))
if [ -z "$team_mem" ]
then
break
fi
echo "$teamName,$team_mem,$team_mem_roll" >> output
done
}
>output #create the file where the output is going to be there
touch sorted_input
sort $1 > sorted_input
while read line;
do
# echo $line
lineForm
done<sorted_input #The input stream for read is from the input file The read will continue till the EOF
sed -i -e "s/\r//" output
rm sorted_input
#!/bin/bash
a=$(cat $2)
b=$(cat $1)
for i in $(echo $a)
do
b=$(echo "$b" | sed 's/'$i'/bleep/gI')
done
echo "$b" > output
#!/bin/bash
#The program looks at file recursively(use of r flag)
#using grep with -c flag counts the number of lines in each file with matching pattern.
output1=$(grep -rch "[^[:space:]\t]" $1)
cnt=0
for var in $output1
do
cnt=$((var+cnt))
done
echo $cnt
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment