Sponsored Content
Top Forums Shell Programming and Scripting Force new line after second space Post 302969404 by Junaid Subhani on Tuesday 22nd of March 2016 11:24:51 AM
Old 03-22-2016
Force new line after second space

Hi guys,

I am trying to manipulate a text file.

An example of the file is :

Code:
65450524121|2015-11-20 20:17:59.0 15062464121|2015-12-19 11:44:23.0 01419644121|2016-03-19 09:56:41.0 55146524121|2015-08-17 04:51:55.0 11947314121|2015-12-03 19:25:26.0 29906064121|2015-10-28 18:25:00.0 71585954121|2015-06-10 22:12:13.0 87207383121|2015-11-14 14:15:10.0 77259583121|2015-06-11 16:16:56.0 52186364121|2015-09-25 19:03:33.0 06360373121|2016-02-13 03:01:51.0 42749704121|2015-06-12 11:16:12.0 08136964121|2015-08-02 08:38:16.0 77927982021|2015-06-12 14:03:50.0 29058473121|2016-01-27 08:45:21.0 76950351121|2015-06-12 15:20:28.0 86970264121|2016-03-13 20:01:42.0 99917064121|2016-03-15 08:27:13.0 26313374121|2016-03-05 14:10:40.0 57014064121|2016-03-02 11:22:50.0 23145234121|2015-11-30 17:29:50.0 32740714121|2016-03-02 16:00:43.0 99956193121|2015-11-14 15:56:05.0 68785893121|2015-10-24 19:17:40.0 27418563121|2016-03-13 11:06:56.0 51823193121|2015-07-20 10:49:44.0 75230854121|2016-02-29 13:38:16.0

I want to force a new line after the second space.

I tried to do something like:

Code:
cat output.log | tr " " "\n"

But its doing that on ALL spaces.

How can I force this only on the second space it detects ?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

replace space with new line

i have a file named as templist which looks like this: i want to translate spaces to a new line so that the file would look like this im using sed with this sed -e 's/" "/\n/' templist > templist.out but it doesn't work. can someone please help me. (2 Replies)
Discussion started by: dakid
2 Replies

2. Shell Programming and Scripting

How to print the words in the same line with space or to the predefined line?

HI, cat test abc echo "def" >> test output is cat test abc def the needed output is cat test abc def and so on (5 Replies)
Discussion started by: jobycxa
5 Replies

3. Shell Programming and Scripting

Stripping out more than a space from a line, but keep single space.

Hi all, Is there a way to perform the above, I am trying to strip out more than one space from a line, but keep the single space. See below output example. My Name is test test2 test3 test4 test5 My Name is test test2 test3 test4 test5 Please note that the lines would contain... (7 Replies)
Discussion started by: eo29
7 Replies

4. Shell Programming and Scripting

Replace end of line with a space

for eg: i have i/p file as: ================ i wnt to change end of line ================= my require ouput is like: i wnt to change end of line ==================== (7 Replies)
Discussion started by: RahulJoshi
7 Replies

5. Shell Programming and Scripting

Parse a line by a space

I am trying to show each word on a separate line, but read in all the words on one command line. Below is the code I have right now: read name MyString=$name name2=" " echo $MyString | awk -v ORS="" '{ gsub(/./,"&\n") ; print }' | \ while read char do if then ... (8 Replies)
Discussion started by: tvb2727
8 Replies

6. Shell Programming and Scripting

Space at beginning of the line

How can I delete spaces at the begining of all lines of my file ? (2 Replies)
Discussion started by: Sara_84
2 Replies

7. Shell Programming and Scripting

remove space of each line

Hi Guys, I want remove starting space of each line ... My Input: A B C D E C V F G H F R T Y U D F G H J L O I U Y G P O K O P L O L O I P P O P P P P P My Output: A B C D E C V F G H (7 Replies)
Discussion started by: asavaliya
7 Replies

8. Shell Programming and Scripting

Check if line has a space

Hi, I want to check if the given line from a text file has a spaces in between. if it does, then I want to add '"' double quotes at the beginning and end of the line. Otherwise leave the line as it is. For example, below is the sample content from my file. $cat file.txt test1 test2... (6 Replies)
Discussion started by: svajhala
6 Replies

9. UNIX for Dummies Questions & Answers

How to remove fields space and append next line to previous line.?

awk 'BEGIN{FS = "Ç"} NR == 1 {p = $0; next} NF > 1 {print p; p = $0} NF <= 1 {p = (p " " $0)} END {print p}' input.txt > output.txt This is what the input data file looks like with broken lines Code: 29863 Ç890000000 Ç543209911 ÇCHNGOHG Ç000000001 Ç055 ... (4 Replies)
Discussion started by: cumeh1624
4 Replies

10. Shell Programming and Scripting

Using the entire line with space in between

Hi Folks, I have a report data like the one seen below. FRUITS@NEW_ORANGE(1500 04/29) FRUITS@NEW_ORANGE(1500 05/04) FRUITS@NEW_ORANGE(1500 05/05) FRUITS@NEW_ORANGE(1500 05/07) FRUITS@NEW_ORANGE(1500 05/12) I need to use each of this lines separately in another for loop like the one... (2 Replies)
Discussion started by: jayadanabalan
2 Replies
SECURETTY(5)						     Linux Programmer's Manual						      SECURETTY(5)

NAME
securetty - file which lists terminals from which root can log in DESCRIPTION
The file /etc/securetty contains the names of terminals (one per line, without leading /dev/) which are considered secure for the transmis- sion of certain authentication tokens. It is used by (some versions of) login(1) to restrict the terminals on which root is allowed to login. See login.defs(5) if you use the shadow suite. On PAM enabled systems, it is used for the same purpose by pam_securetty(8) to restrict the terminals on which empty passwords are accepted. FILES
/etc/securetty SEE ALSO
login(1), login.defs(5), pam_securetty(8) COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. Linux 2015-03-29 SECURETTY(5)
All times are GMT -4. The time now is 09:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy