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
JavaScript::Minifier::XS(3pm)				User Contributed Perl Documentation			     JavaScript::Minifier::XS(3pm)

NAME
JavaScript::Minifier::XS - XS based JavaScript minifier SYNOPSIS
use JavaScript::Minifier::XS qw(minify); $minified = minify($js); DESCRIPTION
"JavaScript::Minifier::XS" is a JavaScript "minifier"; its designed to remove un-necessary whitespace and comments from JavaScript files, which also not breaking the JavaScript. "JavaScript::Minifier::XS" is similar in function to "JavaScript::Minifier", but is substantially faster as its written in XS and not just pure Perl. METHODS
minify($js) Minifies the given $js, returning the minified JavaScript back to the caller. HOW IT WORKS
"JavaScript::Minifier::XS" minifies the JavaScript by removing un-necessary whitespace from JavaScript documents. Comments (both block and line) are also removed, except when (a) they contain the word "copyright" in them, or (b) they're needed to implement "IE Conditional Compilation". Internally, the minification process is done by taking multiple passes through the JavaScript document: Pass 1: Tokenize First, we go through and parse the JavaScript document into a series of tokens internally. The tokenizing process does not check to make sure you've got syntactically valid JavaScript, it just breaks up the text into a stream of tokens suitable for processing by the subsequent stages. Pass 2: Collapse We then march through the token list and collapse certain tokens down to their smallest possible representation. If they're still included in the final results we only want to include them at their shortest. Whitespace Runs of multiple whitespace characters are reduced down to a single whitespace character. If the whitespace contains any "end of line" (EOL) characters, then the end result is the first EOL character encountered. Otherwise, the result is the first whitespace character in the run. Pass 3: Pruning We then go back through the token list and prune and remove un-necessary tokens. Whitespace Wherever possible, whitespace is removed; before+after comment blocks, and before+after various symbols/sigils. Comments Comments that are either (a) IE conditional compilation comments, or that (b) contain the word "copyright" in them are preserved. All other comments (line and block) are removed. Everything else We keep everything else; identifiers, quoted literal strings, symbols/sigils, etc. Pass 4: Re-assembly Lastly, we go back through the token list and re-assemble it all back into a single JavaScript string, which is then returned back to the caller. AUTHOR
Graham TerMarsch (cpan@howlingfrog.com) REPORTING BUGS
Please report bugs via RT (<http://rt.cpan.org/Dist/Display.html?Queue=JavaScript::Minifier::XS>), and be sure to include the JavaScript that you're having troubles minifying. COPYRIGHT
Copyright (C) 2007-2008, Graham TerMarsch. All Rights Reserved. This is free software; you can redistribute it and/or modify it under the same license as Perl itself. SEE ALSO
"JavaScript::Minifier". perl v5.14.2 2011-11-15 JavaScript::Minifier::XS(3pm)
All times are GMT -4. The time now is 01:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy