The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Remove blank line - SED pcwiz Shell Programming and Scripting 10 11-11-2008 11:19 PM
sed: delete regex line and next line if blank one71 Shell Programming and Scripting 2 09-18-2008 06:53 AM
del blank line after each line tjmannonline UNIX for Dummies Questions & Answers 1 04-12-2008 05:56 PM
How to get last non-blank line? tqlam Shell Programming and Scripting 6 01-17-2008 07:13 PM
Blank line ? varungupta UNIX for Advanced & Expert Users 2 09-10-2007 01:52 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-22-2009
kthatch kthatch is offline
Registered User
  
 

Join Date: Mar 2007
Posts: 28
Newbie help with New Line & Blank Line

I have this in my script:

usercount=`ldapsearch -L -b"ou=people,ou=$ou,dc=paisleyhosting,dc=com" -h"$server" -p"1391" cn=* nothing | grep -c dn`

admincount=`ldapsearch -b"ou=groups,ou=$ou,dc=paisleyhosting,dc=com" -h"$server" -p"1391" cn=USERADMIN* uniquemember | grep uniquemember | sort -u | grep -c unique`

adminusers=`ldapsearch -b"ou=groups,ou=$ou,dc=paisleyhosting,dc=com" -h"$server" -p"1391" "(&(objectclass=groupofuniquenames)(cn=useradministrator))" uniquemember | grep uniquemember | cut -d "," -f 1 | cut -d "=" -f 3`


I want to insert a New Line after "admincount" and a Blank Line after "adminsuers" ...

Can you help?
  #2 (permalink)  
Old 01-22-2009
Franklin52 Franklin52 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,346
Why don't you use vi or another editor if you want to insert one line in one script?

Regards
  #3 (permalink)  
Old 01-22-2009
kthatch kthatch is offline
Registered User
  
 

Join Date: Mar 2007
Posts: 28
Because my script produces hundred of lines and it results in many line breaks and blank lines. I want the blank lines and the new lines included in the output.

Last edited by kthatch; 01-22-2009 at 03:39 PM.. Reason: typo
  #4 (permalink)  
Old 01-22-2009
kthatch kthatch is offline
Registered User
  
 

Join Date: Mar 2007
Posts: 28
My output is like this:

301,1,1,301jjones
302,1,1,302jjones
303,200,4,303jdeer
303mjohnson
303jjones
303kwoods
304,30,1,304jjones
305,1,1,305jjones
306,37,3,306jjones
306swalker
306bblanks
........ etc ......

I want output to be:

301,1,1,
301jjones

302,1,1,
302jjones

303,200,4,
303jdeer
303mjohnson
303jjones
303kwoods

304,30,1,
304jjones

305,1,1,
305jjones

306,37,3,
306jjones
306swalker
306bblanks
........ etc ......
  #5 (permalink)  
Old 01-23-2009
kthatch kthatch is offline
Registered User
  
 

Join Date: Mar 2007
Posts: 28
Can someone please help with New Lines and Blank Lines?
  #6 (permalink)  
Old 01-23-2009
vgersh99's Avatar
vgersh99 vgersh99 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,131
something along these lines

nawk -f kt.awk myInputFile

kt.awk:

Code:
BEGIN {
  FS=OFS=","
}
FNR==1 {curr=$1}
$1 != curr && NF>1 { curr=$1; printf "\n"}
{
  if (NF>3)
     print $1,$2,$3 ORS $4
  else
     print
}

Closed Thread

Bookmarks

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:31 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0