|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Add a newline after every period
I need to add a newline after every period.
Here is some sample text. The mechanisms for this type of conditioning are probably the same in humans. According to PET scans on young adults, when pairing a stimulus with an airpuff produces a conditioned eye blink, activity increases in the cerebellum, red nucleus, and several other areas (Logan & Grafton, 1995). People who have damage in the cerebellum have weaker conditioned eye blinks, and the blinks are less accurately timed relative to the onset of the airpuff (Gerwig et al., 2005). |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
Try this: Code:
sed -e 's/\. */.\n/g' -e 's/\.$/.\n/g' infile |
| Sponsored Links | ||
|
|
#3
|
||||
|
||||
|
Code:
tr '. ' '\n' < filename |
|
#4
|
|||
|
|||
|
That will convert every period and space to a newline, not append a newline after the period. Quote:
A more portable alternative: Code:
sed 's/\. */.\ /g' Regards, Alister |
| The Following User Says Thank You to alister For This Useful Post: | ||
danbroz (11-19-2012) | ||
| Sponsored Links | |
|
![]() |
| Tags |
| awk, perl, sed, tr |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How can I add a newline In a text file using Shell Script | kpopfreakghecky | Shell Programming and Scripting | 1 | 08-29-2011 11:12 PM |
| How can I add a newline In a text file using Shell Script | kpopfreakghecky | UNIX for Dummies Questions & Answers | 1 | 08-29-2011 11:10 PM |
| add newline in file after finding specific text | jxh461 | Shell Programming and Scripting | 4 | 07-23-2009 12:31 AM |
| How to get rid of the last period (.) | dannytrinh | Shell Programming and Scripting | 4 | 08-26-2008 07:48 AM |
| grep and sed to find a pattern and add newline | ssikhar | Shell Programming and Scripting | 5 | 10-26-2004 05:32 PM |
|
|