0% found this document useful (0 votes)
1K views1 page

Mock Pra 1 Solution Unix

This script uses awk to summarize book sales data from a pipe-delimited file. It prints the book name, price, and an offer (Buy1Get2 for prices over 750, 100RsCashback for prices between 500-750, or FreeDelivery for lower prices). Total sales are also calculated.

Uploaded by

Siva Karthick
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views1 page

Mock Pra 1 Solution Unix

This script uses awk to summarize book sales data from a pipe-delimited file. It prints the book name, price, and an offer (Buy1Get2 for prices over 750, 100RsCashback for prices between 500-750, or FreeDelivery for lower prices). Total sales are also calculated.

Uploaded by

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

awk -F "|" 'BEGIN{total=0; print "Book Name|Price|Offer"}

{ if(NR>1)
{
if($3 > 750)
offer="Buy1Get2";
else if($3 > 500 && $3 < 750)
offer="100RsCashback";
else
offer="FreeDelivery";
print $2"|"$3"|"offer;}
}' $1

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