0% found this document useful (0 votes)
19 views4 pages

Mock System Commands

Uploaded by

sinhatushar.iitm
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views4 pages

Mock System Commands

Uploaded by

sinhatushar.iitm
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Mock System Commands

System Commands :
Question 1
Version 1

cat Pincode_info.csv | cut -d "," -f 5 | egrep "(.).*\\1" | wc -l

Version 2

cat Pincode_info.csv | grep -o "[0-9]*" | sed -E 's/0/k/2' | sed -E 's/1/k/2' | sed -E


's/2/k/2' | sed -E 's/3/k/2' | sed -E 's/4/k/2' | sed -E 's/5/k/2' | sed -E 's/6/k/2'
| sed -E 's/8/k/2' | sed -E 's/9/k/2' | sed -E 's/7/k/2' | grep k |wc -l

Question 2

cut -d "," -f 9 Pincode_info.csv > final.txt


cat final.txt | awk '\\''{
arr[$0]++
}
END{
for(a in arr) {
printf("%s:%s\\n",a,arr[a])
}
}'\\''

Question 3

ln /encryption/two-level/binary/positive-offset/encoding-key ek

Question 4

Mock System Commands 1


grep -f result map | cut -d " " -f 2 | xargs grep "INVESTMENT" | cut -d " " -f 2 | cu
t -c 2- > result.txt ;
sum=0
while read -r line
do
(( sum += line ))
done < result.txt
echo $sum

Question 5

BEGIN{
FS=" "
cost=0
}
{

arr[$1]+=$2

}
END{
for(i in arr){
print i, arr[i]
}

Question 6

#!/usr/bin/awk -f
BEGIN {FS = ","
leave_sum_1997 = 0
leave_sum_1998 = 0
leave_sum_1999 = 0
leave_sum_2000 = 0

leave_count_1997 = 0
leave_count_1998 = 0
leave_count_1999 = 0
leave_count_2000 = 0

Final_Avg_1997 = 0
Final_Avg_1998 = 0
Final_Avg_1999 = 0
Final_Avg_2000 = 0

Mock System Commands 2


}
{
year = substr($1,2,4);

if (year == 1997)
{
leave_sum_1997 = leave_sum_1997 + $3
leave_count_1997++
}

if (year == 1998)
{
leave_sum_1998 = leave_sum_1998 + $3
leave_count_1998++
}

if (year == 1999)
{
leave_sum_1999 = leave_sum_1999 + $3
leave_count_1999++
}

if (year == 2000)
{
leave_sum_2000 = leave_sum_2000 + $3
leave_count_2000++
}

}
END {
if (leave_count_1997 !=0){Final_Avg_1997 = leave_sum_1997/leave_count_1997}
if (leave_count_1998 !=0){Final_Avg_1998 = leave_sum_1998/leave_count_1998}
if (leave_count_1999 !=0){Final_Avg_1999 = leave_sum_1999/leave_count_1999}
if (leave_count_2000 !=0){Final_Avg_2000 = leave_sum_2000/leave_count_2000}
print int(Final_Avg_1997)
print int(Final_Avg_1998)
print int(Final_Avg_1999)
print int(Final_Avg_2000)

Question 7

sed 's/delta/gamma/2i' input.txt

Mock System Commands 3


Question 8

s/^"""\\(.*\\)"""/#\\1/

/"""/,/"""/ {s/\\(.*\\)/#\\1/;s/"""//}
/^#$/d

Mock System Commands 4

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy