Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
- The problem statement, all variables and given/known data:
After using the egrep command to pull certain lines from the asg5f1 (creating the asg5f1c file), I am required to use the sed command in order to change all tabs in the asg5f1c file to a colon, and dump the results into a temporary file. As I understand it, in the asg5f1c file <tab> is a delimiter, and I believe I am being asked to change the delimiter from a tab to a colon.
Below is an example of what I believe the asg5f1c file should look like after the egrep command, and what the sed command will be working on (roughed-in on MS Word�).
Employee Hours Rate Hours Rate Gross Net
lname, fname 99 99.99 99 99.99 999.99 999.99
lname, fname 99 99.99 99 99.99 999.99 999.99
After this, i am to sort the asg5f1c file and join it with another file in order to create the asg51 file.
At this point, I'm :wall:. This problem is causing a domino effect for the latter parts of the assignment, and thus holding up the whole line.
With my previous use of the sed command, I thought that the following:
sed �s/<tab key pressed>/:/g� asg5f1c > tmp1
would solve my problem. The way I read the above line is �In the file asg5f1c, for all instances of a tab, substitute in a colon, and place the result into tmp1.� The above sed command outputs the following:
lname, fname:40.00:6.50: 2.00: 9.75:279.50:176.09
lname, fname:40.00:6.50:: 9.75:260.00:163.00
lname, fname:25.00:6.50:: 9.75:162.50:102.38
lname, fname :40.00:6.50: 3.00: 9.75:289.25:182.23
lname, fname :40.00:6.50:: 9.75:260.00:163.00
lname, fname :33.00:6.50:: 9.75:214.50:135.14
lname, fname:40.00:5.50:: 8.25:220.00:138.60
lname, fname :40.00:5.50:: 8.25:220.00:138.60
lname, fname :40.00:4.25:10.00: 6.38:233.75:147.26
lname, fname :40.00:7.50::11.25:300.00:189.00
This is holding me up because my asg51 file looks the same as the above output, with the addition of a colon at the end of each line. From here, I am to cut the gross pay and net pay fields from the asg51 file. The problem being is that apparently the above "faulty" output is one field, and when I cut the pay fields:
cut -f6 asg51 > gp && cut -f7 asg51 > np
the gp & np files look like my "faulty" output, and that's when everything comes to a screeching halt.
-
Relevant commands, code, scripts, algorithms:
Unsure what to put here. Commands I am required to use are egrep, sed & cut. -
The attempts at a solution (include all code and scripts):
I've triedsed 's/\<tab key pressed>/:/g'
andsed 's/\\<tab key pressed>/:/g'
, but nothing works. I read & re-read the text & supplemental readings, but I can't figure it out. -
Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
University of Maryland University College. Adelphi, MD. USA. Prof. T. Tomko. CMIS 325.
*Unable to post link to class because "You are only allowed to post URLs once you have at least 5 posts," and this is my first post.
Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).