Question

In: Computer Science

**Need to use awk command in putty (should be a ONE LINE COMMAND) Write the command...

**Need to use awk command in putty (should be a ONE LINE COMMAND)

Write the command that would find all lines that have an email address and place a label email = before the line in the file longfile output will multiple lines similar to this one :

using a good awk command the output would be something like this

email = From: "Linder, Jann/WDC" <[email protected]>
email = To: Mr Arlington Hewes <[email protected]>
email = > From: Mr Arlington Hewes [SMTP:[email protected]]
email = > To: [email protected]

….etc...

---

the perfect output, but removing the duplicates( accomplished by using | uniq) would be even better:

email = [email protected]
email = [email protected]
email = [email protected]
email = [email protected]
email = [email protected]
email = [email protected]
email = [email protected]

…… etc ...

Solutions

Expert Solution

Note: I have provided two commands, you can use anyone according to your requirement.

Code to copy:

  1. awk '{   for (k=1;k<=NF;k++) {if ( $k ~ /[[:alpha:]]@[[:alpha:]]/ ) {print "email = " $k }}}' "longfile.txt"
  2. awk '/From:|To:|Cc:/ {printf ("email=%s\n" ,$0) ;}' longfile.txt

Output:


Related Solutions

Convert the following code from awk to Perl: (please don't use a2p (awk to perl) command)...
Convert the following code from awk to Perl: (please don't use a2p (awk to perl) command) Here was the original problem: Calculate the grade for each student that appears in the data file. You may calculate the grade based on total earned points, divided by total possible points. Or, for 10 points extra credit; Use the weighted totals for this course; available in the syllabus and on the course home page. Output a list of students, their grade as a...
The program should be able to do the following: In Java accepts one command line parameter....
The program should be able to do the following: In Java accepts one command line parameter. The parameter specifies the path to a text file containing the integers to be sorted. The structure of the file is as follows: There will be multiple lines in the file (number of lines unknown). Each line will contain multiple integers, separated by a single whitespace. reads the integers from the text file in part a into an array of integers. sort the integers...
Introduction Write in C++ at the Linux command line a program that is the same as...
Introduction Write in C++ at the Linux command line a program that is the same as the previous collection app project but now uses a class to store the items and also can save the items to a file that can be read back into the array by the user when the program is re-started. You can use your project 1 submission as a starting point or you can do something new as long as it meets the listed requirements....
Here are the tasks for this assignment: 1. Write a bash command line to determine if...
Here are the tasks for this assignment: 1. Write a bash command line to determine if the server 'syccuxfs01.pcc.edu' is reachable from the syccuxas01.pcc.edu server. 2. As you have read, TCP/IP messages are passed from one device to another until the message reaches its destination. Write a bash command line that will verify that no more than two (2) network devices are used to pass messages from the syccuxas01.pcc.edu server to the www.pcc.edu server. 3. Write a bash command line...
Write a program that takes two command line arguments at the time the program is executed....
Write a program that takes two command line arguments at the time the program is executed. You may assume the user enters only decimal numeric characters. The input must be fully qualified, and the user should be notified of any value out of range for a 23-bit unsigned integer. The first argument is to be considered a data field. This data field is to be is operated upon by a mask defined by the second argument. The program should display...
Write a program that prints the sum of its command-line arguments (assuming they are numbers). For...
Write a program that prints the sum of its command-line arguments (assuming they are numbers). For example, java Adder 3 2.5 -4.1 should print The sum is 1.4
Write a program that takes an integer N from the command line and uses StdRandom.uniform() to...
Write a program that takes an integer N from the command line and uses StdRandom.uniform() to generate a random sequence of integers be- tween 0 and N – 1. Run experiments to validate the hypothesis that the number of integers generated before the first repeated value is found is ~√?N/2.
Write the line x = 0:2:20; in the Command Window of MATLAB and then create a...
Write the line x = 0:2:20; in the Command Window of MATLAB and then create a Simulink model that first loads x from the Workspace, then creates a vector y such that y = 2.5x + ex , and finally sends the vector y back to the Workspace. You will need a From Workspace block, a To Workspace block, two Constant blocks, a Product block, and a Sum block. Note that there is a sample time associated with the From...
Write a script named countmatches that expects at least two arguments on the command line. The...
Write a script named countmatches that expects at least two arguments on the command line. The first argument is the pathname of a dna file containing a valid DNA string with no newline characters or white space characters of any kind within it. (It will be terminated with a newline character.) This dna file contains nothing but a sequence of the bases a, c, g, and t in any order. The remaining arguments are strings containing only the bases a,...
For this assignment, you will create a command-line version of the game ​Hangman. You should work...
For this assignment, you will create a command-line version of the game ​Hangman. You should work in a group of two on the project and not view Hangman code of other students or found on-line. Submit this project-- your .java file-- here on Canvas. For this assignment you will research on StringBuilder Class (​Use this link​) and use it in your code. Functional requirements (rubric) ● Your game should have a list of at least ten phrases of your choosing...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT