UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old March 1st, 2004, 03:19 PM
Mas786 Mas786 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 1 Mas786 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Assignment Help

Hi I Am an inexperienced user of unix and have been assigned a coursework which looks at uix command and was looking to see if any experienced users could help. The following commands mut be explained:

1) sed -e 's/$/ /'

2) fold -1

3) sed -e 's/ /*/'

4) awk '{if ( $0 == "*" )printf "\n"; else printf "%s", $0;}'

5) sed -e 's/[[\](){}\!,.;:-]//g'

6) awk '{ if ( $0 == last ) { count = count + 1; } else { printf
": %d\n%s", count, $0; count = 1 }; last = $0} END { printf ": %d\n",
count }'

If any one could explain what each step would do and the entire process could they please get back to me asap, thanx for taking the time to look at this message

Reply With Quote
  #2  
Old March 2nd, 2004, 01:32 PM
munkfish's Avatar
munkfish munkfish is offline
funky munky
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2001
Location: UK
Posts: 1,446 munkfish User rank is Corporal (100 - 500 Reputation Level)munkfish User rank is Corporal (100 - 500 Reputation Level)munkfish User rank is Corporal (100 - 500 Reputation Level)munkfish User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 18 h 33 m
Reputation Power: 10
1) search for anything ending in $ and replace it with a period mark.
2) add an extra line to every other line.
3. search for a period and replace it with everything that comes after the period.
4) search for anything that doesn't match anything that previously occured on the last line and replace it with a newline, unless it's at the end of a line.
5) change all punctuation with bias
6) I'll leave that one to you, but the above should help you out a bit.

Reply With Quote
  #3  
Old March 10th, 2004, 10:18 PM
drgroove's Avatar
drgroove drgroove is offline
pushing envelopes, not pencils
Dev Shed God 2nd Plane (6000 - 6499 posts)
 
Join Date: Feb 2002
Posts: 6,224 drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Day 4 h 34 m 57 sec
Reputation Power: 174
Quote:
Originally Posted by Mas786
Hi I Am an inexperienced user of unix and have been assigned a coursework which looks at uix command and was looking to see if any experienced users could help. The following commands mut be explained:

1) sed -e 's/$/ /'

2) fold -1

3) sed -e 's/ /*/'

4) awk '{if ( $0 == "*" )printf "\n"; else printf "%s", $0;}'

5) sed -e 's/[[\](){}\!,.;:-]//g'

6) awk '{ if ( $0 == last ) { count = count + 1; } else { printf
": %d\n%s", count, $0; count = 1 }; last = $0} END { printf ": %d\n",
count }'

If any one could explain what each step would do and the entire process could they please get back to me asap, thanx for taking the time to look at this message



Have you tried consulting the man pages on each of these? Whatever happened to people doing the /own/ homework in school?
__________________
Give a person code, and they'll hack for a day; Teach them how to code, and they'll hack forever.
Analyze twice; hack once.
The world's first existential ITIL question: If a change is released into production without a ticket to track it,
was it actually released?


About DrGroove: ITIL-Certified IT Process Engineer - Enterprise Application Architect -
Freelance IT Journalist - Devshed Moderator - Funk Bassist Extraordinaire


Reply With Quote
  #4  
Old March 12th, 2004, 07:48 AM
sunvsunv sunvsunv is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 139 sunvsunv User rank is Corporal (100 - 500 Reputation Level)sunvsunv User rank is Corporal (100 - 500 Reputation Level)sunvsunv User rank is Corporal (100 - 500 Reputation Level)sunvsunv User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 16 h 10 m 55 sec
Reputation Power: 7
Quote:
2) fold -1

Quote:
2) add an extra line to every other line.


On TRU64 UNIX it does not happen.

Let us take a file which contains numbers from 1 to 10. Let us name it as "number"
Code:
cat number
123 456
78 90


Now if you give
Code:
 fold -1 number 

then it gives you one chracter per line.
this will be the out put.
1
2
3

4
5
6

7
8

90

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > Assignment Help


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway