<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>The UNIX and Linux Forums - Shell Programming and Scripting</title>
		<link>http://www.unix.com/</link>
		<description>Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.</description>
		<language>en</language>
		<lastBuildDate>Fri, 20 Nov 2009 21:40:32 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>5</ttl>
		<image>
			<url>http://solaris.unix.com/images/misc/rss.jpg</url>
			<title>The UNIX and Linux Forums - Shell Programming and Scripting</title>
			<link>http://www.unix.com/</link>
		</image>
		<item>
			<title>do a full comparison of folder contents in script</title>
			<link>http://www.unix.com/shell-programming-scripting/124280-do-full-comparison-folder-contents-script-new-post.html</link>
			<pubDate>Fri, 20 Nov 2009 21:34:59 GMT</pubDate>
			<description><![CDATA[Hello everyone.... 
 
I have a small issue here at work and I am trying to script out a way to automate a fix for it.  I have a small number of users (I work in a 1:1 with 6,000 macbooks) that aren't really managed in my deployment.  They are managed with a few policies, but the policies are broken...]]></description>
			<content:encoded><![CDATA[<div>Hello everyone....<br />
<br />
I have a small issue here at work and I am trying to script out a way to automate a fix for it.  I have a small number of users (I work in a 1:1 with 6,000 macbooks) that aren't really managed in my deployment.  They are managed with a few policies, but the policies are broken because they never turn their laptops in or get them reimaged.  I have had to wipe LDAP a few times for upgrades/maintenance/fixes and their synchronized portable home directory has a different UID than the new UID since I did fresh imports of user accounts both times I destroyed and rebuilt LDAP.<br />
<br />
So, I have a script written which seems to be going the correct way of doing this, but I am not exactly a Unix wizard so I have some basic questions hopefully someone here can help me with.  <br />
<br />
The script's function will be to copy all local user accounts in /Users to /Users/username.bu for a full back up of the account.  Then, it will initiate a log out, and a log out hook that will run the second script that will verify all data is copied to the back up folder (.bu) and then delete the account from directory services and wipe the original data out of their local user account.  <br />
<br />
This way, when the user logs in next, they will have pulled down the new account to their machine that has the exact same user/password but this time it will be the right UID.  Then they will be in the proper OD groups and get group policy as normal.  <br />
<br />
I hope that makes sense.  Also, only accounts that have a UID higher than 1000+ are directory accounts, so I want to ignore all accounts with an UID less than 999.  <br />
<br />
So far here is my script I wrote, and like I mentioned, I am completely self taught and have no formal education in programming.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">#!/bin/bash<br />
<br />
#<br />
# First we need to grab the synchronnized user account<br />
# All directory accounts will have a UID greater than 1000<br />
# All local accounts will have a UID of 500 to 999<br />
# We only want to move accounts with UID of greater than 1000<br />
# This will also exclude the shared folder<br />
#<br />
<br />
userlist=`/bin/ls /Users | /usr/bin/grep -v &quot;^Shared&quot;`<br />
<br />
checkuid=`/usr/bin/dscl . read /Users/$i UniqueID | /usr/bin/awk '/ID/ { print $2 }'`<br />
<br />
for i in $userlist ; do<br />
<br />
if (( $checkuid &gt; 999 )) <br />
<br />
&nbsp; &nbsp; then /bin/mkdir /Users/$i.bu ;; /bin/cp -R /Users/$i /Users/$i.bu<br />
<br />
&nbsp; &nbsp; else /bin/echo &quot;$i is not a directory user&quot;<br />
<br />
fi<br />
<br />
done<br />
<br />
#<br />
# now the tricky part we need to verify what was done, is done then delete the old account<br />
# so the user can sync the new account with the proper UID<br />
#<br />
<br />
homefolder=`/bin/ls -l $userlist/`<br />
<br />
backup=&quot;/Users/$userlist.bu&quot;<br />
<br />
# now compare contents<br />
<br />
if [[ $homefolder == $backup ]]<br />
<br />
&nbsp; &nbsp; then /usr/sbin/dscl . -delete /Users/$userlist<br />
<br />
&nbsp; &nbsp; else /bin/echo &quot;Contents do not match, exiting&quot;<br />
<br />
&nbsp; &nbsp; exit 1<br />
<br />
fi<br />
<br />
done<br />
<br />
#<br />
# Now remove the contents of those user accounts by comparing what has <br />
# .bu on the end<br />
#<br />
<br />
removeuser=`/bin/ls /Users | /usr/bin/grep &quot;.bu&quot;<br />
<br />
/bin/rm -rf /Users/$removeuser<br />
<br />
exit 0</code><hr />
</div>Now the second script will just copy that data back after the user logs in again and resynchronizes their PHD with the proper UID.  Then the last bit will apply ownership to that new UID and exit.<br />
<br />
A few questions....<br />
<br />
1)  Should I have used an integer comparison when comparing the current UID to it being greater than 999?<br />
<br />
2)  There are probably some issues with this script as I have not tested it out fully yet, because I was wanting some feed back to see if there was a better way to go.  Is there a more efficient way to go about this?<br />
<br />
<br />
Thanks for anyone who can help, it is greatly appreciated.<br />
<br />
Tom</div>

]]></content:encoded>
			<category domain="http://www.unix.com/shell-programming-scripting/">Shell Programming and Scripting</category>
			<dc:creator>tlarkin</dc:creator>
			<guid isPermaLink="true">http://www.unix.com/shell-programming-scripting/124280-do-full-comparison-folder-contents-script.html</guid>
		</item>
		<item>
			<title>help with script</title>
			<link>http://www.unix.com/shell-programming-scripting/124278-help-script-new-post.html</link>
			<pubDate>Fri, 20 Nov 2009 21:05:29 GMT</pubDate>
			<description>I have a file which is *comma* delimited.  I have around 35 fields in each row.  The problem is in the 21st field I have data separated by *;*  I need the data in only the 21st field separated by ; to be replaced by |.  This is a very big file and I need something in awk that its much faster...</description>
			<content:encoded><![CDATA[<div>I have a file which is <b>comma</b> delimited.  I have around 35 fields in each row.  The problem is in the 21st field I have data separated by <b>;</b>  I need the data in only the 21st field separated by ; to be replaced by |.  This is a very big file and I need something in awk that its much faster than regular commands.  Can anybody tell exactly how I can only achieve this for 21st field.</div>

]]></content:encoded>
			<category domain="http://www.unix.com/shell-programming-scripting/">Shell Programming and Scripting</category>
			<dc:creator>dsravan</dc:creator>
			<guid isPermaLink="true">http://www.unix.com/shell-programming-scripting/124278-help-script.html</guid>
		</item>
		<item>
			<title>How to Pull out multiple files from DB table and redirect all those files to a differetn directory?</title>
			<link>http://www.unix.com/shell-programming-scripting/124277-how-pull-out-multiple-files-db-table-redirect-all-those-files-differetn-directory-new-post.html</link>
			<pubDate>Fri, 20 Nov 2009 20:54:24 GMT</pubDate>
			<description>Hi everyone!! 
 
I have a *database table*, which has file_name as one of its fields.  
Example: 
 
File_ID   File_Name   Directory   Size 
0001     UNO_1232   /apps/opt  234 
0002     UNO_1234   /apps/opt  788 
0003     UNO_1235   /apps/opt  897 
0004     UNO_1236   /apps/opt  568</description>
			<content:encoded><![CDATA[<div>Hi everyone!!<br />
<br />
I have a <b>database table</b>, which has file_name as one of its fields. <br />
Example:<br />
<br />
File_ID   File_Name   Directory   Size<br />
0001     UNO_1232   /apps/opt  234<br />
0002     UNO_1234   /apps/opt  788<br />
0003     UNO_1235   /apps/opt  897<br />
0004     UNO_1236   /apps/opt  568<br />
<br />
I have to extract all the files whose size is greater than 500 and send all those files to a different directory /apps/opt/new <br />
<br />
How do I loop through the table and send all those file_names, which match the size criteria to a different directory?<br />
<br />
Thanks in advance..<br />
Please do help me out, as this is very urgent for me.</div>

]]></content:encoded>
			<category domain="http://www.unix.com/shell-programming-scripting/">Shell Programming and Scripting</category>
			<dc:creator>ss3944</dc:creator>
			<guid isPermaLink="true">http://www.unix.com/shell-programming-scripting/124277-how-pull-out-multiple-files-db-table-redirect-all-those-files-differetn-directory.html</guid>
		</item>
		<item>
			<title>finding files with unicode chars in the filename</title>
			<link>http://www.unix.com/shell-programming-scripting/124276-finding-files-unicode-chars-filename-new-post.html</link>
			<pubDate>Fri, 20 Nov 2009 20:00:13 GMT</pubDate>
			<description><![CDATA[I'm trying to check-in a repository to svn -- but the import is failing because some files waaaay down deep in some graphics-library folder are using unicode characters in the file name - which are masked using the ls command but picked up when piping output to more: 
 
[root@dev-www-02 emoticons]#...]]></description>
			<content:encoded><![CDATA[<div>I'm trying to check-in a repository to svn -- but the import is failing because some files waaaay down deep in some graphics-library folder are using unicode characters in the file name - which are masked using the ls command but picked up when piping output to more:<br />
<br />
[root@dev-www-02 emoticons]# ls -l 1914*<br />
-rwxrwxr-x 1 apache apache 1398 Dec  9  2008 1914OdiN_Presenta_-_o_?.bmp<br />
[root@dev-www-02 emoticons]# ls -l 1914* | more<br />
-rwxrwxr-x 1 apache apache 1398 Dec  9  2008 1914OdiN_Presenta_-_o_ō.bmp<br />
<br />
Optimally, I'd like to be able to search and quarantine these files into a directory out of the repository tree, but I'm brickwalling :mad: trying to figure out the search string...<br />
<br />
I've tried variants of grep '^[A-Za-z0-9]' but can't turn up the right combination.<br />
<br />
tia...</div>

]]></content:encoded>
			<category domain="http://www.unix.com/shell-programming-scripting/">Shell Programming and Scripting</category>
			<dc:creator>mshallop</dc:creator>
			<guid isPermaLink="true">http://www.unix.com/shell-programming-scripting/124276-finding-files-unicode-chars-filename.html</guid>
		</item>
		<item>
			<title>Insert Text Between Html Tags Sed / Awk ?</title>
			<link>http://www.unix.com/shell-programming-scripting/124264-insert-text-between-html-tags-sed-awk-new-post.html</link>
			<pubDate>Fri, 20 Nov 2009 14:07:19 GMT</pubDate>
			<description>Hello, I have searched for the title stringon this post on this site as well as on google with no luck.  I find similar examples, however I am truly having a tough time resolving the issue that I am faced with. 
I have multiple html files that I need to change the title on.  These are simple html...</description>
			<content:encoded><![CDATA[<div>Hello, I have searched for the title stringon this post on this site as well as on google with no luck.  I find similar examples, however I am truly having a tough time resolving the issue that I am faced with.<br />
I have multiple html files that I need to change the title on.  These are simple html text files that look like this:<br />
<br />
Input File:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">&lt;title&gt;oldtitle&lt;/title&gt;<br />
&lt;body&gt;<br />
this is a test page for this example.<br />
&lt;/body&gt;</code><hr />
</div>Desired Output:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">&lt;title&gt;newtitle&lt;/title&gt;<br />
&lt;body&gt;<br />
this is a test page for this example.<br />
&lt;/body&gt;</code><hr />
</div><br />
I have tried something like this.  However I think that I am over thinking this.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left"><acronym title="Stream Editor">sed</acronym> -e &quot;s/\(&lt;oldtitle [^&gt;]*&gt;\)[^&lt;]*\(&lt;.*\)/\newtitle\2/g&quot; file1.html &gt; newfile.html</code><hr />
</div>Please Advise,<br />
<br />
Abacus</div>

]]></content:encoded>
			<category domain="http://www.unix.com/shell-programming-scripting/">Shell Programming and Scripting</category>
			<dc:creator>abacus</dc:creator>
			<guid isPermaLink="true">http://www.unix.com/shell-programming-scripting/124264-insert-text-between-html-tags-sed-awk.html</guid>
		</item>
		<item>
			<title>remove last 4 characters from a string</title>
			<link>http://www.unix.com/shell-programming-scripting/124262-remove-last-4-characters-string-new-post.html</link>
			<pubDate>Fri, 20 Nov 2009 13:53:18 GMT</pubDate>
			<description><![CDATA[I'm tring to remove the last 4 characters from strings in a file i.e. 
  
cat /tmp/test 
iwishicouldremovethis 
icouldremovethos 
  
so i would end up with the last 4 characters from each of the above i.e. 
this 
thos]]></description>
			<content:encoded><![CDATA[<div>I'm tring to remove the last 4 characters from strings in a file i.e.<br />
 <br />
cat /tmp/test<br />
iwishicouldremovethis<br />
icouldremovethos<br />
 <br />
so i would end up with the last 4 characters from each of the above i.e.<br />
this<br />
thos<br />
 <br />
I thought of using cut -c ... but I'm not sure how many characters will precede the important &quot;Last 4 characters i need&quot;.<br />
 <br />
Thanks for your help!</div>

]]></content:encoded>
			<category domain="http://www.unix.com/shell-programming-scripting/">Shell Programming and Scripting</category>
			<dc:creator>josslate</dc:creator>
			<guid isPermaLink="true">http://www.unix.com/shell-programming-scripting/124262-remove-last-4-characters-string.html</guid>
		</item>
		<item>
			<title><![CDATA[Keeping " in string variable]]></title>
			<link>http://www.unix.com/shell-programming-scripting/124248-keeping-string-variable-new-post.html</link>
			<pubDate>Fri, 20 Nov 2009 12:57:39 GMT</pubDate>
			<description><![CDATA[Hi again, 
in my bash script I have several variable strings like in an array 
 
Code: 
--------- 
STRING_NAME[1]="qqq qqq qqq" 
STRING_NAME[2]="www www www" 
STRING_NAME[3]="eee eee eee" 
--------- 
This strings are passed to another program as]]></description>
			<content:encoded><![CDATA[<div>Hi again,<br />
in my bash script I have several variable strings like in an array<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">STRING_NAME[1]=&quot;qqq qqq qqq&quot;<br />
STRING_NAME[2]=&quot;www www www&quot;<br />
STRING_NAME[3]=&quot;eee eee eee&quot;</code><hr />
</div>This strings are passed to another program as<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">${STRING_NAME[$J]}</code><hr />
</div>The problem is the program doesn't recognize the whole string<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">&quot;qqq qqq qqq&quot;</code><hr />
</div>but<br />
<br />
three time <div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">qqq</code><hr />
</div>Any help? Thanks<br />
Sarah</div>

]]></content:encoded>
			<category domain="http://www.unix.com/shell-programming-scripting/">Shell Programming and Scripting</category>
			<dc:creator>f_o_555</dc:creator>
			<guid isPermaLink="true">http://www.unix.com/shell-programming-scripting/124248-keeping-string-variable.html</guid>
		</item>
		<item>
			<title>Shell script problem</title>
			<link>http://www.unix.com/shell-programming-scripting/124243-shell-script-problem-new-post.html</link>
			<pubDate>Fri, 20 Nov 2009 12:07:16 GMT</pubDate>
			<description>I have one shell script that is used to load data in database. Can I run same  shell script to load multiples files or folders on same database.</description>
			<content:encoded><![CDATA[<div>I have one shell script that is used to load data in database. Can I run same  shell script to load multiples files or folders on same database.</div>

]]></content:encoded>
			<category domain="http://www.unix.com/shell-programming-scripting/">Shell Programming and Scripting</category>
			<dc:creator>krishntiwary</dc:creator>
			<guid isPermaLink="true">http://www.unix.com/shell-programming-scripting/124243-shell-script-problem.html</guid>
		</item>
		<item>
			<title>How to check if export DISPLAY is set or not?</title>
			<link>http://www.unix.com/shell-programming-scripting/124242-how-check-if-export-display-set-not-new-post.html</link>
			<pubDate>Fri, 20 Nov 2009 11:49:12 GMT</pubDate>
			<description><![CDATA[Hi All, 
  
  
I use "export DISPLAY=same_host:0.0" to set my export DISPLAY and it is working fine for me.. 
  
  
Problem here is I have developed a script for which i should run export DISPLAY prior to running my script.... 
  
so my script should check whether export DISPLAY is set or not.. if...]]></description>
			<content:encoded><![CDATA[<div>Hi All,<br />
 <br />
 <br />
I use &quot;export DISPLAY=same_host:0.0&quot; to set my export DISPLAY and it is working fine for me..<br />
 <br />
 <br />
Problem here is I have developed a script for which i should run export DISPLAY prior to running my script....<br />
 <br />
so my script should check whether export DISPLAY is set or not.. if set then it should continue else it should give error.. Please Help me</div>

]]></content:encoded>
			<category domain="http://www.unix.com/shell-programming-scripting/">Shell Programming and Scripting</category>
			<dc:creator>smarty86</dc:creator>
			<guid isPermaLink="true">http://www.unix.com/shell-programming-scripting/124242-how-check-if-export-display-set-not.html</guid>
		</item>
		<item>
			<title>invaluable resource for  shell one liners and more</title>
			<link>http://www.unix.com/shell-programming-scripting/124241-invaluable-resource-shell-one-liners-more-new-post.html</link>
			<pubDate>Fri, 20 Nov 2009 11:44:04 GMT</pubDate>
			<description>Hi all, 
This link might help whom is seeking a quick solutions for thier daily shell needs. 
 
linkAll commands | commandlinefu.com (http://www.commandlinefu.com/commands/browse)</description>
			<content:encoded><![CDATA[<div>Hi all,<br />
This link might help whom is seeking a quick solutions for thier daily shell needs.<br />
<br />
link<a href="http://www.commandlinefu.com/commands/browse" target="_blank">All commands | commandlinefu.com</a></div>

]]></content:encoded>
			<category domain="http://www.unix.com/shell-programming-scripting/">Shell Programming and Scripting</category>
			<dc:creator>h@foorsa.biz</dc:creator>
			<guid isPermaLink="true">http://www.unix.com/shell-programming-scripting/124241-invaluable-resource-shell-one-liners-more.html</guid>
		</item>
		<item>
			<title>How to match a exact word in a variable ????</title>
			<link>http://www.unix.com/shell-programming-scripting/124240-how-match-exact-word-variable-new-post.html</link>
			<pubDate>Fri, 20 Nov 2009 11:40:02 GMT</pubDate>
			<description><![CDATA[Hi All, 
 
Str="online maintenance" 
if [ $str == "online" ] then perform some action 
 
I know the above comparison is wrong ..... Actually I am very new to this solaris.. 
 
I want to check for online in a variable and perform some action based on that How can I do it?]]></description>
			<content:encoded><![CDATA[<div>Hi All,<br />
<br />
Str=&quot;online maintenance&quot;<br />
if [ $str == &quot;online&quot; ] then perform some action<br />
<br />
I know the above comparison is wrong ..... Actually I am very new to this solaris..<br />
<br />
I want to check for online in a variable and perform some action based on that How can I do it?</div>

]]></content:encoded>
			<category domain="http://www.unix.com/shell-programming-scripting/">Shell Programming and Scripting</category>
			<dc:creator>vijaysachin</dc:creator>
			<guid isPermaLink="true">http://www.unix.com/shell-programming-scripting/124240-how-match-exact-word-variable.html</guid>
		</item>
		<item>
			<title>Help to merge multiple .sql files</title>
			<link>http://www.unix.com/shell-programming-scripting/124238-help-merge-multiple-sql-files-new-post.html</link>
			<pubDate>Fri, 20 Nov 2009 10:37:31 GMT</pubDate>
			<description>Hello all,  
  
I have a shell script that uses multiple .sql files. These .sql files mainly contain Oracle SQL queries to pull fields from the database. I want to place all the contents of these .sql files in one .sql file and have some parameter sent based on which the respective block or query...</description>
			<content:encoded><![CDATA[<div>Hello all, <br />
 <br />
I have a shell script that uses multiple .sql files. These .sql files mainly contain Oracle SQL queries to pull fields from the database. I want to place all the contents of these .sql files in one .sql file and have some parameter sent based on which the respective block or query would gets executed accordingly. <br />
 <br />
Please help me know if this is feasible and how this can be accomplished. Please let me know if this is not clear or further clarification is required. Thanks in advance for your help. <br />
 <br />
Thanks, <br />
Niranjan</div>

]]></content:encoded>
			<category domain="http://www.unix.com/shell-programming-scripting/">Shell Programming and Scripting</category>
			<dc:creator>snvniranjanrao</dc:creator>
			<guid isPermaLink="true">http://www.unix.com/shell-programming-scripting/124238-help-merge-multiple-sql-files.html</guid>
		</item>
		<item>
			<title>New page character 0x0C vs 0x0D</title>
			<link>http://www.unix.com/shell-programming-scripting/124237-new-page-character-0x0c-vs-0x0d-new-post.html</link>
			<pubDate>Fri, 20 Nov 2009 10:21:48 GMT</pubDate>
			<description>Is there a way to substitute ina  file a 0x0C (new page!) character into a 0x0D (carriage return)? 
 
Thank you, 
Sarah</description>
			<content:encoded><![CDATA[<div>Is there a way to substitute ina  file a 0x0C (new page!) character into a 0x0D (carriage return)?<br />
<br />
Thank you,<br />
Sarah</div>

]]></content:encoded>
			<category domain="http://www.unix.com/shell-programming-scripting/">Shell Programming and Scripting</category>
			<dc:creator>f_o_555</dc:creator>
			<guid isPermaLink="true">http://www.unix.com/shell-programming-scripting/124237-new-page-character-0x0c-vs-0x0d.html</guid>
		</item>
		<item>
			<title>Format data to columns addind spaces</title>
			<link>http://www.unix.com/shell-programming-scripting/124236-format-data-columns-addind-spaces-new-post.html</link>
			<pubDate>Fri, 20 Nov 2009 10:01:11 GMT</pubDate>
			<description>Hi all, 
  
I have a problem to format data from different database queries into one look. The input data are as follows, every line has the same number of values but a different number of characters: 
  
 
Code: 
--------- 
adata, bdata,     cdata,    ddata 
fffdata,  gdata,      hdata,    idata...</description>
			<content:encoded><![CDATA[<div>Hi all,<br />
 <br />
I have a problem to format data from different database queries into one look. The input data are as follows, every line has the same number of values but a different number of characters:<br />
 <br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">adata, bdata,&nbsp; &nbsp;  cdata,&nbsp; &nbsp; ddata<br />
fffdata,&nbsp; gdata,&nbsp; &nbsp; &nbsp; hdata,&nbsp; &nbsp; idata<br />
jdata,&nbsp; &nbsp; kdata,&nbsp;  ldata,&nbsp;  mdaata</code><hr />
</div>What I want is a formatted output with the same number of characters in each line:<br />
 <br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">adata,&nbsp;  bdata, cdata, ddata<br />
fffdata, gdata, hdata, idata<br />
jdata,&nbsp;  kdata, ldata, mdaata</code><hr />
</div>Iīm useing Redhat-Linux and ksh.<br />
 <br />
Thanks for your support!</div>

]]></content:encoded>
			<category domain="http://www.unix.com/shell-programming-scripting/">Shell Programming and Scripting</category>
			<dc:creator>old_mike</dc:creator>
			<guid isPermaLink="true">http://www.unix.com/shell-programming-scripting/124236-format-data-columns-addind-spaces.html</guid>
		</item>
		<item>
			<title>Extracting N lines match number X of a pattern</title>
			<link>http://www.unix.com/shell-programming-scripting/124234-extracting-n-lines-match-number-x-pattern-new-post.html</link>
			<pubDate>Fri, 20 Nov 2009 09:51:11 GMT</pubDate>
			<description>Hi All, 
as the title says I need to extract N lines after match number X of a pattern. 
e.g. 
111 
xxx 
xxx 
111 
yyy 
yyy 
111</description>
			<content:encoded><![CDATA[<div>Hi All,<br />
as the title says I need to extract N lines after match number X of a pattern.<br />
e.g.<br />
111<br />
xxx<br />
xxx<br />
111<br />
yyy<br />
yyy<br />
111<br />
www<br />
www<br />
111<br />
zzz<br />
zzz<br />
<br />
I would like to extract the two lines after the second 111 occurrence.<br />
<br />
I tried with grep but I didn't find any options to do that.<br />
Any help?<br />
Thank you,<br />
Sarah</div>

]]></content:encoded>
			<category domain="http://www.unix.com/shell-programming-scripting/">Shell Programming and Scripting</category>
			<dc:creator>f_o_555</dc:creator>
			<guid isPermaLink="true">http://www.unix.com/shell-programming-scripting/124234-extracting-n-lines-match-number-x-pattern.html</guid>
		</item>
	</channel>
</rss>
