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:
  #1  
Old April 19th, 2005, 07:09 AM
ensign47 ensign47 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 1 ensign47 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 50 m 13 sec
Reputation Power: 0
Unhappy Please help!

Hi

I'm a newbie here so sorry if I sound like an idiot.

I'm studying Unix at the moment and am in the midst of my mid term assignment, but am having problems with some questions and was hoping you guys could 'please' help me.

1 - List files in you home directory and output ONLY the file count (number of files) to the command line - using the list command and piping.

2 - Remove all files ending in a numer OR capital letter - using the ls command.

3 - Manipulate the date command so that it outputs the date only like so: Mar 21 2005. Using a pipe to sed, insert a comma after the day so that the output becomes Mar 21, 2005.

Also Im having some problems with some sed and grep things (just can't get the grip of it).

What will be matched by the following regular expressions -
i- ^Hello$
ii- [0-9]\{1,3},[0-9]\{3\}
iii- ^\..

and finally

Change multiple blank lines in the file to single blank lines (we are using a standard vi txt file).

If anyone can please help with either one or all of these I would be eternally grateful.

Thanks so much
Ensign47

Reply With Quote
  #2  
Old April 19th, 2005, 09:44 AM
vgersh99 vgersh99 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 47 vgersh99 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 Days 5 h 48 m 21 sec
Reputation Power: 4
Send a message via AIM to vgersh99 Send a message via MSN to vgersh99 Send a message via Yahoo to vgersh99
although it IS a homework and anyone here would expect SOME kind of input from the poster in terms of the solution.....

here's something to go on....

Quote:
Originally Posted by ensign47
Hi

I'm a newbie here so sorry if I sound like an idiot.

I'm studying Unix at the moment and am in the midst of my mid term assignment, but am having problems with some questions and was hoping you guys could 'please' help me.

1 - List files in you home directory and output ONLY the file count (number of files) to the command line - using the list command and piping.

ls -l | sed -n '/^-/p' | ....
the '....' represents the 'counting' part of the question
Quote:
Originally Posted by ensign47
2 - Remove all files ending in a numer OR capital letter - using the ls command.

ls | sed -n '/[0-9]$/p;/[A-Z]$/p' | ....

the '....' represents the 'remove' part of the question

Quote:
Originally Posted by ensign47
3 - Manipulate the date command so that it outputs the date only like so: Mar 21 2005. Using a pipe to sed, insert a comma after the day so that the output becomes Mar 21, 2005.

date '+%b %M %Y' | sed 's/ [0-9][0-9]*$/,&/'

Quote:
Originally Posted by ensign47
Also Im having some problems with some sed and grep things (just can't get the grip of it).

What will be matched by the following regular expressions -
i- ^Hello$
ii- [0-9]\{1,3},[0-9]\{3\}
iii- ^\..

and finally

Change multiple blank lines in the file to single blank lines (we are using a standard vi txt file).

If anyone can please help with either one or all of these I would be eternally grateful.

Thanks so much
Ensign47


For the rest..... pls try to find the solution(s) yourself and if you have problems - come back with the specific questions to identify where you're getting stuck [if you are].

Reply With Quote
  #3  
Old April 19th, 2005, 08:55 PM
ensign47 ensign47 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 1 ensign47 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 50 m 13 sec
Reputation Power: 0
THanks so much for your help. I really appreciate it.

I know its homework, but ive been struggling with it for ages and was totally lost.

Thanks again
Netrom

Reply With Quote
  #4  
Old April 19th, 2005, 08:59 PM
ensign47 ensign47 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 1 ensign47 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 50 m 13 sec
Reputation Power: 0
thanks for your help.

I know its homework but ive been working on it for ages and was totally stuck.

Thanks again. I really appreciate it.
Netrom

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > Please 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
Stay green...Green IT