Sponsored Content
Top Forums Shell Programming and Scripting Extend the Output length of a row Post 302262202 by Franklin52 on Wednesday 26th of November 2008 03:08:31 PM
Old 11-26-2008
Quote:
Originally Posted by ulin
Hi

i apologize for that, i have made a mistake in my query,my output looks like ,there is a whitespace in the continuation of the first line to the second line, but i need the output in a single line

firstrecord|secondrecord|thirdrecord|fourthrecord|fivthrecord|s
(Whitespace)ixhrecord|seventhrecord|

coulmnone|coulmntwo|coulmnthree|coulmnfour|coulmnfive|coul
(Whitespace)mnsix|coulmnseven|

which would need to be like ,

firstrecord|secondrecord|thirdrecord|fourthrecord|fivthrecord|sixhrecord|seventhrecord|
coulmnone|coulmntwo|coulmnthree|coulmnfour|coulmnfive|coulmnsix|coulmnseven|

Kindly advice.
Try this:

Code:
awk '!/\|$/ && NF{s=$0;getline;sub(/^ /, "");print s $0}' file

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

creating a fixed length output from a variable length input

Is there a command that sets a variable length? I have a input of a variable length field but my output for that field needs to be set to 32 char. Is there such a command? I am on a sun box running ksh Thanks (2 Replies)
Discussion started by: r1500
2 Replies

2. Shell Programming and Scripting

top output for six processes with the same name, output changed from column to row

Hi, I have a system under test, and I use a script that does a ps. The output, is in the following format, it's basically the timestamp, followed by the rss and vsize. 09:03:57 68404 183656 68312 181944 69860 217360 67536 182564 69072 183172 69032 199276 09:04:27 68752 183292 70000 189020... (5 Replies)
Discussion started by: Bloke
5 Replies

3. UNIX for Dummies Questions & Answers

Capping output redirection log file length

I am trying to write a script which will output notifications to a logfile, but I would like to cap the logfile to, let's say, 200 lines. Specifically I am using custom firmware, DD-wrt, on my router and I am implementing a script to connect to my work vpn. I have a loop that pings a computer... (2 Replies)
Discussion started by: joemommasfat
2 Replies

4. Shell Programming and Scripting

convert a column to row output?

Getting tired of cut-and-paste...so I thought I would post a question. how do I change this column output to a single row? from this: # vgdisplay -v /dev/vgeva05 | grep dsk | awk '{print $3}' /dev/dsk/c6t0d5 /dev/dsk/c11t0d5 /dev/dsk/c15t0d5 /dev/dsk/c18t0d5 /dev/dsk/c7t0d5... (8 Replies)
Discussion started by: mr_manny
8 Replies

5. Shell Programming and Scripting

extending the line length of nohup output

Hi I'm backgrounding matlab jobs using nohup. My foreground programs are written for an xterm that has 132 columns. When I use nohup and redirect the output to nohup.out, the default appears to be something like 72 columns, which breaks up my formatted screen output from matlab commands... (1 Reply)
Discussion started by: LeoSimon
1 Replies

6. Shell Programming and Scripting

Column to row output

Hello All, i have a file with the contents like shown below Name = POLICY1 Selected = 1 Written = 0 Name = POLICY2 Selected = 6 Written = 8 Name = POLICY3 Selected = 4 Written = 26 I want the output to be... (5 Replies)
Discussion started by: vinredmac
5 Replies

7. UNIX for Dummies Questions & Answers

Count on grep for more than two values in a row of fixed length file

I want to get count on number of records in a few folders by running grep command for more than two columns in a row of fixed length file. suppose if i have a fixed length file has 5 columns and I want to see the record counts for country =can and province = bc and time stamp <= 12 feb 2013... (14 Replies)
Discussion started by: princetd001
14 Replies

8. UNIX for Dummies Questions & Answers

Finding row number along with length of row

I have a fixed length file and I want to find out row number along with row length. I have a program that give me the line length if it satisfy the condition; but i would like to add row number as well? How do I do that? while IFS= read -r line; do if ; then echo ${line} echo... (8 Replies)
Discussion started by: princetd001
8 Replies

9. Shell Programming and Scripting

awk to output the percentage of a field compared to length

The awk below using the sample input would output the following: Basically, it averages the text in $5 that matches if $7 < 30 . awk '{if(len==0){last=$5;total=$7;len=1;getline}if($5!=last){printf("%s\t%f\n", last,... (6 Replies)
Discussion started by: cmccabe
6 Replies

10. Shell Programming and Scripting

Bash - delete from csv all the row if the first column is length >

Hi guys, i have a csv file like: USERID;COG;DESCR;FIL;OFF user001;user;test1;001;A01 user002;user;test2;002;A02 user0003;user;test3;003;A03 user004;user;test4;004;A04 user0005;user;test5;005;A05 etc.. I need to read line for line and, if value of first column is > 7 char (in this example... (4 Replies)
Discussion started by: kamose
4 Replies
PPI::Token::Whitespace(3)				User Contributed Perl Documentation				 PPI::Token::Whitespace(3)

NAME
PPI::Token::Whitespace - Tokens representing ordinary white space INHERITANCE
PPI::Token::Whitespace isa PPI::Token isa PPI::Element DESCRIPTION
As a full "round-trip" parser, PPI records every last byte in a file and ensure that it is included in the PPI::Document object. This even includes whitespace. In fact, Perl documents are seen as "floating in a sea of whitespace", and thus any document will contain vast quantities of "PPI::Token::Whitespace" objects. For the most part, you shouldn't notice them. Or at least, you shouldn't have to notice them. This means doing things like consistently using the "S for significant" series of PPI::Node and PPI::Element methods to do things. If you want the nth child element, you should be using "schild" rather than "child", and likewise "snext_sibling", "sprevious_sibling", and so on and so forth. METHODS
Again, for the most part you should really not need to do anything very significant with whitespace. But there are a couple of convenience methods provided, beyond those provided by the parent PPI::Token and PPI::Element classes. null Because PPI sees documents as sitting on a sort of substrate made of whitespace, there are a couple of corner cases that get particularly nasty if they don't find whitespace in certain places. Imagine walking down the beach to go into the ocean, and then quite unexpectedly falling off the side of the planet. Well it's somewhat equivalent to that, including the whole screaming death bit. The "null" method is a convenience provided to get some internals out of some of these corner cases. Specifically it create a whitespace token that represents nothing, or at least the null string ''. It's a handy way to have some "whitespace" right where you need it, without having to have any actual characters. tidy "tidy" is a convenience method for removing unneeded whitespace. Specifically, it removes any whitespace from the end of a line. Note that this doesn't include POD, where you may well need to keep certain types of whitespace. The entire POD chunk lives in its own PPI::Token::Pod object. SUPPORT
See the support section in the main module. AUTHOR
Adam Kennedy <adamk@cpan.org> COPYRIGHT
Copyright 2001 - 2011 Adam Kennedy. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. perl v5.16.2 2011-02-25 PPI::Token::Whitespace(3)
All times are GMT -4. The time now is 08:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy