Help Me Please


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help Me Please
# 1  
Old 10-21-2008
Data Help Me Please

Smilie I Have a file Say XYZ , I need a shell script in unix which will append 52 extra spaces at end of each line of the file excluding first and last line

Please help me out for the same Smilie

Last edited by deepam; 10-21-2008 at 06:26 AM..
# 2  
Old 10-21-2008
Code:
perl -i.bak -ple'$_.=" "x52unless$.==1||eof' XYZ


Last edited by radoulov; 10-21-2008 at 05:22 AM.. Reason: added -i :)
# 3  
Old 10-21-2008
below script will add four space together with 'end' at each line except first and last line. Hope can make sense to you.

Code:
sed '1 !{
  $ !{
    s/\(.*\)/\1        end/
  }
}' filename

# 4  
Old 10-21-2008
Thanx for your needfull Help Smilie

Last edited by deepam; 10-21-2008 at 08:34 AM..
# 5  
Old 10-21-2008
What do you think will you have to change in this script to add a "big number of spaces" instead of "4 spaces and 'end'"?

"do you think" is the key phrase here: the availability of our community and the willingness of us to helps others (you) out does not exempt you from the necessity to work yourself on a problem. Neither does it exempt you from getting knowledge about the tools used. We are gladly helping others to go if they are lying flat - but we will neither go for them nor carry them for any arbitrary time.

A second thing is: as we answer your and others questions here we are trying to build up a knowledge base. If someone else has a problem similar or equal to yours s/he should be able to search the archives and find this thread and use what we have written to you. What do you think, in light of this, is helping this cause when your problem description - the title of your thread - is "help me please". Why do you expect us to understand your problem and work out an answer if you are not even willing to understand and correctly phrase your problem much less solve it. You took the time to format your post fancily and put in some smilies, but you didn't take the time to think about what your problem really is. Think about your priorities, svp.

bakunin
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question