Sponsored Content
Top Forums Shell Programming and Scripting Concatinating the lines based on number of delimiters Post 302640949 by birei on Tuesday 15th of May 2012 01:02:34 PM
Old 05-15-2012
Hi bi.infa,

One way using perl:
Code:
$ cat infile
Title| ID| Owner| Estimate| Project| Complexity| Done| Feature Group|
Sprint|
RR - Bug in m_tgt_fact_org_hierarchy mapping| D-04980| fgfggf
Sejhh| 5.00| 2012 BI Project| | | 1.3 Ratings Reporting| Sprint 10
(10 -23 May)|
Intermediate results reports for US banks -Sprint1| B-49625| fhgh
fgh| 8.00| 2012 BI Project| | | 3.6 FI-RACE| Sprint 10 (10 -23 May)|
$ perl -ne 'BEGIN { $/ = q[|] } s/\n//g; print $_, $. % 9 == 0 ? "\n" : ""' infile
Title| ID| Owner| Estimate| Project| Complexity| Done| Feature Group|Sprint|
RR - Bug in m_tgt_fact_org_hierarchy mapping| D-04980| fgfggfSejhh| 5.00| 2012 BI Project| | | 1.3 Ratings Reporting| Sprint 10(10 -23 May)|
Intermediate results reports for US banks -Sprint1| B-49625| fhghfgh| 8.00| 2012 BI Project| | | 3.6 FI-RACE| Sprint 10 (10 -23 May)|

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How can I get an if statement to execute based on number of lines in a file?

I need to have an if statement in a script to run if there are certain processes running. Easiest way I can see to do this is to run a ps and grep the results based on what I am looking for: $ ps -ef | grep wtrs --- webtrend 5046 1 0 May 12 ? 0:28 /webtrends/versions/6.1/wtrs_ui... (6 Replies)
Discussion started by: LordJezo
6 Replies

2. Shell Programming and Scripting

Script to split files based on number of lines

I am getting a few gzip files into a folder by doing ftp to another server. Once I get them I move them to another location .But before that I need to make sure each gzip is not more than 5000 lines and split it up . The files I get are anywhere from 500 lines to 10000 lines in them and is in gzip... (4 Replies)
Discussion started by: gubbu
4 Replies

3. Shell Programming and Scripting

Delete lines based on line number

I have a file with ~200K lines, I need to delete 4K lines in it. There is no range. I do have the line numbers of the lines which I want to be deleted. I did tried using > cat del.lines sed '510d;12d;219d;......;3999d' file > source del.lines Word too long. I even tried... (2 Replies)
Discussion started by: novice_man
2 Replies

4. Shell Programming and Scripting

Merge two non-consecutive lines based on line number or string

This is a variation of an earlier post found here: unixcom/shell-programming-scripting/159821-merge-two-non-consecutive-lines.html User Bartus11 was kind enough to solve that example. Previously, I needed help combining two lines that are non-consecutive in a file. Now I need to do the... (7 Replies)
Discussion started by: munkee
7 Replies

5. Shell Programming and Scripting

join based on line number when one file is missing lines

I have a file that contains 87 lines, each with a set of coordinates (x & y). This file looks like: 1 200.3 -0.3 2 201.7 -0.32 ... 87 200.2 -0.314 I have another file which contains data that was taken at certain of these 87 positions. i.e.: 37 125 42 175 86 142 where the first... (1 Reply)
Discussion started by: jackiev
1 Replies

6. UNIX for Dummies Questions & Answers

Command to split the files based on the number of lines in it

Hello Friends, Can anyone help me for the below requirement. I am having a file called Input.txt. My requirement is first check the count that is wc -l input.txt If the result of the wc -l Input.txt is less than 10 then don't split the Input.txt file. Where as if Input.txt >= 10 the split... (12 Replies)
Discussion started by: malaya kumar
12 Replies

7. Shell Programming and Scripting

Replacing a character with a number based on lines

Hi, I am in need of help for the two things which is to be done. First, I have a file that has around four columns. The first column is filled with letter "A". There are around 400 lines in the files as shown below. A 1 5.2 3.2 A 2 0.2 4.5 A 1 2.2 2.2 A 5 2.1 ... (2 Replies)
Discussion started by: begin_shell
2 Replies

8. UNIX for Dummies Questions & Answers

Split file based on number of blank lines

Hello All , I have a file which needs to split based on the blank lines Name ABC Address London Age 32 (4 blank new line) Name DEF Address London Age 30 (4 blank new line) Name DEF Address London (8 Replies)
Discussion started by: Pratik4891
8 Replies

9. Shell Programming and Scripting

Print lines based on line number and specified condition

Hi, I have a file like below. 1,2,3,4,5,6,7,8,9I would like to print or copied to a file based of line count in perl If I gave a condition 1 to 3 then it should iterate over above file and print 1 to 3 and then again 1 to 3 etc. output should be 1,2,3 4,5,6 7,8,9 (10 Replies)
Discussion started by: Anjan1
10 Replies

10. Shell Programming and Scripting

Awk: Combine multiple lines based on number of fields

If a file has following kind of data, comma delimited 1,2,3,4 1 1 1,2,3,4 1,2 2 2,3,4 My required output must have only 4 columns with comma delimited 1,2,3,4 111,2,3,4 1,222,3,4 I have tried many awk command using ORS="" but couldnt progress (10 Replies)
Discussion started by: mdkm
10 Replies
X.Org(7x)																 X.Org(7x)

NAME
X.Org, XProjectTeam - X.Org Group information SYNOPSIS
Release 6.5 and 6.6 of X Version 11 was brought to you by The X.Org Group. Release 6.4 of X Version 11 was brought to you by The X Project Team. DESCRIPTION
The Open Group's X Project Team was created as the successor to the X Consortium, Inc., after the X Consortium was merged into The Open Group. The X.Org Group (hereinafter called "X.Org") was created as the successor to The X Project Team after the The Open Group ceased operating The X Project Team. The purpose of X.Org is to foster development, evolution, and maintenance of the X Window System. X.Org operates under the corporate umbrella of The Open Group. The X Consortium was an independent, not-for-profit Delaware membership corporation. It was formed in 1993 as the successor to the MIT X Consortium. The X Window System was created in the mid-1980s at the Massachusetts Institute of Technology. In 1988, MIT formed a member-funded consor- tium to provide the technical and administrative leadership necessary to support further development of the X Window System. In 1992, MIT and the membership decided it was in their best interests to move the consortium out of MIT and create an independent, stand-alone organi- zation. All rights to the X Window System were assigned by MIT to X Consortium, Inc. on January 1, 1994. X Consortium, Inc. closed its doors on December 31, 1996. All rights to the X Window System have been assigned to The Open Group, for the benefit of the members of X.Org. ADDRESS
To reach The Open Group public World Wide Web server, use http://www.opengroup.org/. To reach The X.Org public World Wide Web server, use http://www.x.org/. To reach The X.Org public ftp machine, use anonymous ftp at ftp://ftp.x.org/ FULL MEMBERS
Attachmate Barco Compaq Hewlett-Packard Hummingbird IBM ICS Metro Link MITRE Shiman Associates Silicon Graphics Incorporated Starnet Communications Sun Microsystems The XFree86 Project US Navy WRQ Xi Graphics X Version 11 Release 6.6 X.Org(7x)
All times are GMT -4. The time now is 06:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy