LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-12-2007, 05:15 AM   #1
sagarbsa
LQ Newbie
 
Registered: Oct 2007
Posts: 7

Rep: Reputation: 0
Shell Scripting for KSH


Hiii,

I have to add a new blank line to a file before each day field. The file looks some what like this.

Mon 10 oct 11.30 pm
idskafaslkj
dsflhsajkdf
sdflsa,nf
Mon 10 oct 11.55 pm
hfdksaje
dfgsdfg
fdgsd
wrljhfk
werflflakaj
Tue 11 oct 10.05 am
fsadfsf
sdfsadf
asdfsadfa
Wed 12 oct 11.55pm
dfasfasdf
sda
fsdaf
sdf

I have written a shell script but can add space only for a single day ex monday. The command is as follows

sed -e '/Mon/{x;p;x;}' error.log>e.q

How do I add the othwer days? Help me please
Thanks
Sagar
 
Old 10-12-2007, 06:37 AM   #2
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,697
Blog Entries: 5

Rep: Reputation: 244Reputation: 244Reputation: 244
Code:
awk '/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)/ { print "";}1' "file"
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
nautilus scripting - shh-tc.ksh schneidz Programming 1 03-06-2007 12:06 AM
KSH and SCO Shell Scripting mpgram Programming 3 12-29-2005 01:24 PM
Three ksh scripting questions liguorir Linux - Software 2 10-22-2005 01:40 PM
KSH Scripting case statement..... ']['HeBroken Programming 1 12-10-2004 11:38 AM
some ksh scripting nabil Programming 1 03-03-2002 11:34 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:11 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration