11-11-2009
String editing using sed? awk?
1. The problem statement, all variables and given/known data:
Problem Statement for project:
When an account is created on the CS Unix network, a
public html directory is created in the account's home directory. A default web page is put into that directory.
Some users replace or edit the default page, while others do not. We would like to add a new link from the department web page to another page which lists all students who have changed their web page from the default. We don't want to track these things by hand, and we want the list to be automatically updated every night at 3:00AM.
You are to write a script that will
1. find all users who are students and who have changed their web page from the default that
was provided when their account was created,
2. generate an HTML file named student web pages.html which contains a nicely formatted list of links to each student web page that you found,
3. copy that file into a directory specified on the command line, and
4. make sure that anyone can read it.
My Problem:
I have edited the output of the above find command to a file that has lines that look like this:
<p><a href="http://www.cs.ttu.edu/~name">Link</a>
<p><a href="http://www.cs.ttu.edu/~name2">Link</a>
<p><a href="http://www.cs.ttu.edu/~nameasdas">Link</a>
What I need it to do now is take that line and turn it into this:
<p><a href="http://www.cs.ttu.edu/~name">name</a>
<p><a href="http://www.cs.ttu.edu/~name2">name2</a>
<p><a href="http://www.cs.ttu.edu/~nameasdas">nameasdas</a>
I have tried using sed and just can't figure it out. Can anyone help?
2. Relevant commands, code, scripts, algorithms:
Sed ?? awk??
3. The attempts at a solution (include all code and scripts):
4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
Texas Tech University
Lubbock TX
USA
Dr. Pyeatt
CS 3352
Thanks for the help.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello Awk Gurus,
Can anyone of you help me with the below problem. I have got a file having data in below format
pmFaultyTransportBlocks
-----------------------
9842993
pmFrmNoOfDiscRachFrames
-----------------------
NULL
pmNoRecRandomAccSuccess
-----------------------... (4 Replies)
Discussion started by: Mohammed
4 Replies
2. Shell Programming and Scripting
Hi!
I am writing a script handling downloading list of files and I have to check whether file is present locally and if not finished than continue downloading. To do so I have to compare sizes of remote file and local file.
To check remote file size I have to parse something like this:
... (2 Replies)
Discussion started by: hrwath
2 Replies
3. Shell Programming and Scripting
Hi all
I use aix (sadly).
I've got a file consisting of fields separated by commas, I need a sed or awk command that will delete all spaces between two commas as long as there are only spaces between the commas.
eg
,abc, ,sd , ,dr at
would become
,abc,,sd ,,dr at
I have... (53 Replies)
Discussion started by: mychmose
53 Replies
4. Shell Programming and Scripting
Hello,
i have a file, i open the file and read the line, i want to get the first item in the csv file and also teh third+6 item and wirte it to a new csv file. only problem is that using echo it takes TOO LONG:
please help a newbie. below is my code:
WorkingDir=$1
FileName=`cut -d ',' -f... (2 Replies)
Discussion started by: limamichelle
2 Replies
5. Shell Programming and Scripting
Hi all,
I have a list that I would like to parse with awk/sed. The list is contains entries such as:
JournalTitle: Biochemistry
JournalTitle: Biochemistry and cell biology = Biochimie et biologie cellulaire
JournalTitle: Biochemistry and experimental biology
JournalTitle: Biochemistry and... (6 Replies)
Discussion started by: euval
6 Replies
6. Shell Programming and Scripting
HI All,
I am new to unix. I have a file would like to do some editing by using awk, cut and sed. Could anyone help?
This file contain 100 lines. There are one line for example:
2,"102343454",5060,"579668","579668","579668","SIP",,,"825922","035885221283026",1,268,"00:59:00.782 APR 17... (2 Replies)
Discussion started by: mimilaw
2 Replies
7. Shell Programming and Scripting
here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb
cat dump.sql
INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
Discussion started by: vivek d r
10 Replies
8. Shell Programming and Scripting
Dear All,
Can anyone help to remove the , bewteen "" in a string by using sed or awk?
e.g.
input : 1,4,5,"abcdef","we,are,here",4,"help hep"
output:1,4,5,"abcdef","wearehere",4,"help hep"
Thanks,
Mimi (5 Replies)
Discussion started by: mimilaw
5 Replies
9. Shell Programming and Scripting
Sorry for the long/weird title but I'm stuck on a problem I have. I have this XML file:
</member>
<member>
<name>TransactionID</name>
<value><string>123456789123456</string></value>
</member>
<member>
<name>Number</name>
... (9 Replies)
Discussion started by: cozzin
9 Replies
10. Shell Programming and Scripting
I have a file comp.pkglist which mention package version and release . In 'version change' and 'release change' line there are two versions 'old' and 'new' Version Change: --> Release Change: -->
cat comp.pkglist
Package list: nss-util-devel-3.28.4-1.el6_9.x86_64
Version Change: 3.28.4 -->... (1 Reply)
Discussion started by: Paras Pandey
1 Replies