Sponsored Content
Top Forums Shell Programming and Scripting How to print range of a line? Post 302479853 by sussus2326 on Monday 13th of December 2010 05:44:34 AM
Old 12-13-2010
How to print range of a line?

Hi ,

I have a file content like following. In few lines I have fields with '"' and in few not.

Code:
"Country" character varying(150),
    "Region" character varying(60),
    "Total Page Requests" numeric,
    "Pages Served" numeric,
    "Ad request" numeric,
     Ads Served  numeric,
     NFR numeric,
    "Clicks" numeric,
    "CTR" numeric,
    "CPC" numeric,
    "Revenue" numeric,
    "eCPM" numeric

I want to print like following using awk or sed.

Code:
"Country"
    "Region" 
    "Total Page Requests"
    "Pages Served"
    "Ad request" 
     Ads Served 
     NFR 
    "Clicks" 
    "CTR" 
    "CPC"
    "Revenue" 
    "eCPM"

Please help me out.

Thanks in advance.

Last edited by radoulov; 12-13-2010 at 06:47 AM.. Reason: Code tags, please!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

print range between two patterns if it contains a pattern within the range

I want to print between the range two patterns if a particular pattern is present in between the two patterns. I am new to Unix. Any help would be greatly appreciated. e.g. Pattern1 Bombay Calcutta Delhi Pattern2 Pattern1 Patna Madras Gwalior Delhi Pattern2 Pattern1... (2 Replies)
Discussion started by: joyan321
2 Replies

2. Shell Programming and Scripting

Print Range Only Once Per File

Scenario: Each of several .txt files contain the following (but perhaps with some minor variations due to code version running on the devices from which the text was extracted): <output omitted> SWITCH1#show proc cpu hist 1... (4 Replies)
Discussion started by: svermill
4 Replies

3. Solaris

sed print range alongwith line numbers.

hi working with sed in a shell script using sed to print a range of lines from a given file for example to print lines 12-24 from a file sed 12,24p <filename> however i need to print the line numbers, alongwith the actual lines would this be possible at all? Thanks (1 Reply)
Discussion started by: xinuuser
1 Replies

4. Shell Programming and Scripting

awk to print range of fields

Hi file.in and file.out are in csv format. the code I have now is, cat file.in | awk -F"," '!($1$2$3$4$5$6$7$8 in a){a;print $0}' > file.out Here, I am printing entire line using $0. however, I want to print $1 to $150 and it should be in csv format. Cut -d is not good in performace.... (3 Replies)
Discussion started by: krishnix
3 Replies

5. Shell Programming and Scripting

print range of lines matching pattern and previous line

Hi all, on Solaris 10, I'd like to print a range of lines starting at pattern but also including the very first line before pattern. the following doesn't print the range starting at pattern and going down to the end of file: cat <my file> | sed -n -e '/<pattern>{x;p;}/' I need to include the... (1 Reply)
Discussion started by: siriche
1 Replies

6. UNIX for Dummies Questions & Answers

How to specify beginning-of-line/end-of-line characters inside a regex range

How can I specify special meaning characters like ^ or $ inside a regex range. e.g Suppose I want to search for a string that either starts with '|' character or begins with start-of-line character. I tried the following but it does not work: sed 's/\(\)/<do something here>/g' file1 ... (3 Replies)
Discussion started by: jawsnnn
3 Replies

7. Shell Programming and Scripting

Sed print range of lines between line number and pattern

Hi, I have a file as below This is the line one This is the line two <\XMLTAG> This is the line three This is the line four <\XMLTAG> Output of the SED command need to be as below. This is the line one This is the line two <\XMLTAG> Please do the need to needful to... (4 Replies)
Discussion started by: RMN
4 Replies

8. Shell Programming and Scripting

Grep range of lines to print a line number on match

Hi Guru's, I am trying to grep a range of line numbers (based on match) and then look for another match which starts with a special character '$' and print the line number. I have the below code but it is actually printing the line number counting starting from the first line of the range i am... (15 Replies)
Discussion started by: Kevin Tivoli
15 Replies

9. Shell Programming and Scripting

Print range of numbers

Hi I am getting an argument which specifies the range of numbers. eg: 7-15 Is there a way that i can easily (avoiding loop) print the range of number between and including the specified above. The above example should translate to 7,8,9,10,11,12,13,14,15 (3 Replies)
Discussion started by: tostay2003
3 Replies

10. UNIX for Dummies Questions & Answers

How to print specific range using awk?

I want to print specific range of rows and then its columns using awk command. lets say if a file contain 15 line then i need to print line 5 to 9. awk '{print;for( NR>=5&&NR<=9); do; print "<tr>\n<td>"$1"</td><td>"$2"</td><td>"$3"</td>\n</tr" done}' xyz.csv not sure what's wrong... (9 Replies)
Discussion started by: amyt1234
9 Replies
fmin(3M)						  Mathematical Library Functions						  fmin(3M)

NAME
fmin, fminf, fminl - determine minimum numeric value of two floating-point numbers SYNOPSIS
c99 [ flag... ] file... -lm [ library... ] #include <math.h> double fmin(double x, double y); float fminf(float float x, float y); long double fminl(long double x, long double y); DESCRIPTION
These functions determine the minimum numeric value of their arguments. NaN arguments are treated as missing data: if one argument is a NaN and the other numeric, these functions choose the numeric value. RETURN VALUES
Upon successful completion, these functions return the minimum numeric value of their arguments. If just one argument is a NaN, the other argument is returned. If x and y are NaN, a NaN is returned. ERRORS
No errors are defined. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
fdim(3M), fmax(3M), math.h(3HEAD), attributes(5), standards(5) SunOS 5.11 12 Jul 2006 fmin(3M)
All times are GMT -4. The time now is 03:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy