Onle-liner sed script Download the two files. As you can see, "services-ORIG.txt" and "check.txt" are almost identical; the only difference is that "check.txt" has upper case "UDP", "SCTP", "DCCP",...

1 answer below »
This assignment is on writing a one liner with the sed utility.


Onle-liner sed script Download the two files. As you can see, "services-ORIG.txt" and "check.txt" are almost identical; the only difference is that "check.txt" has upper case "UDP", "SCTP", "DCCP", and "TCP" in the second column of service port specifications, but not in the first column of service names (the service names should all remain the same.) Your assignment is to create a "one-liner" using sed that converts services-ORIG.txt to services-NEW.txt; your services-new.txt should be identical to "check.txt". You should not use any other program, and you should not use any pipes, any temporary files, or any instances of ";" and "&&" connections. Instead, your one-liner should only call sed, and use "<" and="" "="">" to redirect your input and output: $ sed 'SOMETHING' < services-orig.txt=""> services-NEW.txt where "SOMETHING" is the sed script to make the requisite changes in the file. You can use the provided "check.txt" to make sure that your code works: $ diff -s services-NEW.txt check.txt Files services-NEW.txt and check.txt are identical $ I would offer three observations that I believe could be of aid to you in this exercise: ● Note that you use regular expressions when specifying the "s" substitute instruction's pattern ● you can use the ( and ) syntax to name portions of matches (see "Back References and Subexpressions) ● and you can use the \U specifier to change the case of a replacement string (see "The s command”) Please put your "one-liner" in a file named "sed.sh"; https://www.gnu.org/software/sed/manual/sed.html#Back_002dreferences-and-Subexpressions https://www.gnu.org/software/sed/manual/sed.html#Back_002dreferences-and-Subexpressions https://www.gnu.org/software/sed/manual/sed.html#The-_0022s_0022-Command # Full data: /usr/share/iana-etc/port-numbers.iana tcpmux 1/TCP tcpmux 1/UDP compressnet 2/TCP compressnet 2/UDP compressnet 3/TCP compressnet 3/UDP rje 5/TCP rje 5/UDP echo 7/TCP echo 7/UDP discard 9/TCP discard 9/UDP discard 9/SCTP discard 9/DCCP systat 11/TCP systat 11/UDP daytime 13/TCP daytime 13/UDP qotd 17/TCP qotd 17/UDP chargen 19/TCP chargen 19/UDP ftp-data 20/TCP ftp-data 20/UDP ftp-data 20/SCTP ftp 21/TCP ftp 21/UDP ftp 21/SCTP ssh 22/TCP ssh 22/UDP ssh 22/SCTP telnet 23/TCP telnet 23/UDP smtp 25/TCP smtp 25/UDP nsw-fe 27/TCP nsw-fe 27/UDP msg-icp 29/TCP msg-icp 29/UDP msg-auth 31/TCP msg-auth 31/UDP dsp 33/TCP dsp 33/UDP time 37/TCP time 37/UDP rap 38/TCP rap 38/UDP rlp 39/TCP rlp 39/UDP graphics 41/TCP graphics 41/UDP name 42/TCP name 42/UDP nameserver 42/TCP nameserver 42/UDP nicname 43/TCP nicname 43/UDP mpm-flags 44/TCP mpm-flags 44/UDP mpm 45/TCP mpm 45/UDP mpm-snd 46/TCP mpm-snd 46/UDP auditd 48/TCP auditd 48/UDP tacacs 49/TCP tacacs 49/UDP re-mail-ck 50/TCP re-mail-ck 50/UDP xns-time 52/TCP xns-time 52/UDP domain 53/TCP domain 53/UDP xns-ch 54/TCP xns-ch 54/UDP isi-gl 55/TCP isi-gl 55/UDP xns-auth 56/TCP xns-auth 56/UDP xns-mail 58/TCP xns-mail 58/UDP acas 62/TCP acas 62/UDP whoispp 63/TCP whoispp 63/UDP covia 64/TCP covia 64/UDP tacacs-ds 65/TCP tacacs-ds 65/UDP sql-net 66/TCP sql-net 66/UDP bootps 67/TCP bootps 67/UDP bootpc 68/TCP bootpc 68/UDP tftp 69/TCP tftp 69/UDP gopher 70/TCP gopher 70/UDP netrjs-1 71/TCP netrjs-1 71/UDP netrjs-2 72/TCP netrjs-2 72/UDP netrjs-3 73/TCP netrjs-3 73/UDP netrjs-4 74/TCP netrjs-4 74/UDP deos 76/TCP deos 76/UDP vettcp 78/TCP vettcp 78/UDP finger 79/TCP finger 79/UDP http 80/TCP http 80/UDP www 80/TCP www 80/UDP www-http 80/TCP www-http 80/UDP http 80/SCTP xfer 82/TCP xfer
Answered 1 days AfterJul 14, 2021

Answer To: Onle-liner sed script Download the two files. As you can see, "services-ORIG.txt" and "check.txt"...

Rajasekar answered on Jul 16 2021
155 Votes
sed 's/\(\/.*\)/\U\1/' < services-ORIG.txt > services-NEW.txt
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here