Sponsored Content
Top Forums Shell Programming and Scripting print whole line if the 1st field contains... Post 302636435 by oreka18 on Monday 7th of May 2012 12:02:40 PM
Old 05-07-2012
print whole line if the 1st field contains...

i want to print lines in a file that the 1st field of each line has a Date shape such:
Code:
yy/mm/dd

or on the other hand contains slash "/" .
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to print empty line when the a field is changed

Hi all, I have this input file .. BSS01 107 Swafieh 11/06/2008 12:06:57 BSS01 111 Ramada_Hotel 12/06/2008 11:37:20 BSS01 147 Kalha_Rep 11/06/2008 19:13:39 BSS01 147 Kalha_Rep ... (9 Replies)
Discussion started by: yahyaaa
9 Replies

2. Shell Programming and Scripting

Print line if first Field matches a pattern

Hi All, I would like my code to be able to print out the whole line if 1st field has a dot in the number. Sample input and expected output given below. My AWK code is below but it can;t work, can any expert help me ? Thanks in advance. {if ($1 ~ /*\.*/) { print $0 }} Input: ... (2 Replies)
Discussion started by: Raynon
2 Replies

3. Shell Programming and Scripting

how to print field n of line m

Hi everyone, I have a basic csh/awk question. How do I print a given field from a given line in a given file? Thanks in advance! (11 Replies)
Discussion started by: Deanne
11 Replies

4. Shell Programming and Scripting

Print the entire line if second field has value P

Friends, I have .txt file with 3 millions of rows. File1.txt ABC1|A|ABCD1|XYZ1 ABC2|P|ABCD2|XYZ2 ABC3|A|ABCD3|XYZ3 ABC4|P|ABCD4|XYZ4 If second field has value P then print the entire line. Thanks in advance for your help, Prashant (4 Replies)
Discussion started by: ppat7046
4 Replies

5. Shell Programming and Scripting

How to print line if field matches?

Hi all, I got several lines line this a b c d e 1 e a 1 c d e 3 f a b c 1 e 8 h a b c d e 1 w a 1 c d e 2 w a b c d e 1 t a b c d e 7 4 How can I print the line if 1 is the field one before the last field? Basicly this 2 field ? a b c d e 1 e a b c d e 1 t The file I got is... (7 Replies)
Discussion started by: stinkefisch
7 Replies

6. Shell Programming and Scripting

only print line if 3rd field is 01

Similar question... I have a space delimited text file and I want to only print the lines where the 3rd word/field/column is equal to "01" awk '{if $3 = "01" print $0}' something like this. I meant to say: only print line IF 3rd field is 01 (2 Replies)
Discussion started by: ajp7701
2 Replies

7. Shell Programming and Scripting

Print a field from the previous line

plz help me!! I have this file , 3408 5600 3796 6035 4200 6285 4676 0 40 1554 200 1998 652 2451 864 2728 1200 0 I want it like if $2==0,replace it with field from the previous line+500 say here the o/p would be like 3408 5600 3796 6035 4200 6285... (16 Replies)
Discussion started by: Indra2011
16 Replies

8. Shell Programming and Scripting

Use two field separator in the same line and print them

Hi Guys, I have the file --- HOST_NAME,data_coleta,data_carga,CPU_util,CPU_idle,run_queue,memory,MEMORY_SYSTEM,MEMORY_TOTAL,MEMORY_SWAPIN,MEMORY_SWAPOUT,DISK_READ,DISK_WRITE,DISK_IO,NET_IN_PACKET, NET_OUT_PACKET... (4 Replies)
Discussion started by: antoniorajr
4 Replies

9. Shell Programming and Scripting

Command/script to match a field and print the next field of each line in a file.

Hello, I have a text file in the below format: Source Destination State Lag Status CQA02W2K12pl:D:\CAQA ... (10 Replies)
Discussion started by: pocodot
10 Replies

10. UNIX for Beginners Questions & Answers

Not sure how to describe it but how to format this list so that it print the 1st field once only

Hi, Not sure how to describe the problem. But basically, I have this file listing here app01_app.test.com.ph|PROGRAM=SQL Developer|HOST=AKL0TS100|USER=Admtest01|HOST=10.111.12.23| app02_app.test.com.ph|PROGRAM=D:\interface\apps\bin32\batch.exe|HOST=AKL0TS100|USER=Admtest09|HOST=10.111.12.35|... (3 Replies)
Discussion started by: newbie_01
3 Replies
MS(7)							 Miscellaneous Information Manual						     MS(7)

NAME
ms - text formatting macros SYNOPSIS
nroff -ms [ options ] file ... troff -ms [ options ] file ... DESCRIPTION
This package of nroff and troff macro definitions provides a formatting facility for various styles of articles, theses, and books. When producing 2-column output on a terminal or lineprinter, or when reverse line motions are needed, filter the output through col(1). All external -ms macros are defined below. Many nroff and troff requests are unsafe in conjunction with this package. However, the first four requests below may be used with impunity after initialization, and the last two may be used even before initialization: .bp begin new page .br break output line .sp n insert n spacing lines .ce n center next n lines .ls n line spacing: n=1 single, n=2 double space .na no alignment of right margin Font and point size changes with f and s are also allowed; for example, ``fIwordfR'' will italicize word. Output of the tbl, eqn, and refer(1) preprocessors for equations, tables, and references is acceptable as input. FILES
/usr/share/tmac/tmac.x /usr/share/ms/x.??? SEE ALSO
eqn(1), refer(1), tbl(1), troff(1) REQUESTS
Macro Initial Break? Explanation Name Value Reset? .AB x - y begin abstract; if x=no don't label abstract .AE - y end abstract .AI - y author's institution .AM - n better accent mark definitions .AU - y author's name .B x - n embolden x; if no x, switch to boldface .B1 - y begin text to be enclosed in a box .B2 - y end boxed text and print it .BT date n bottom title, printed at foot of page .BX x - n print word x in a box .CM if t n cut mark between pages .CT - y,y chapter title: page number moved to CF (TM only) .DA x if n n force date x at bottom of page; today if no x .DE - y end display (unfilled text) of any kind .DS x y I y begin display with keep; x=I,L,C,B; y=indent .ID y 8n,.5i y indented display with no keep; y=indent .LD - y left display with no keep .CD - y centered display with no keep .BD - y block display; center entire block .EF x - n even page footer x (3 part as for .tl) .EH x - n even page header x (3 part as for .tl) .EN - y end displayed equation produced by eqn .EQ x y - y break out equation; x=L,I,C; y=equation number .FE - n end footnote to be placed at bottom of page .FP - n numbered footnote paragraph; may be redefined .FS x - n start footnote; x is optional footnote label .HD undef n optional page header below header margin .I x - n italicize x; if no x, switch to italics .IP x y - y,y indented paragraph, with hanging tag x; y=indent .IX x y - y index words x y and so on (up to 5 levels) .KE - n end keep of any kind .KF - n begin floating keep; text fills remainder of page .KS - y begin keep; unit kept together on a single page .LG - n larger; increase point size by 2 .LP - y,y left (block) paragraph. .MC x - y,y multiple columns; x=column width .ND x if t n no date in page footer; x is date on cover .NH x y - y,y numbered header; x=level, x=0 resets, x=S sets to y .NL 10p n set point size back to normal .OF x - n odd page footer x (3 part as for .tl) .OH x - n odd page header x (3 part as for .tl) .P1 if TM n print header on 1st page .PP - y,y paragraph with first line indented .PT - % - n page title, printed at head of page .PX x - y print index (table of contents); x=no suppresses title .QP - y,y quote paragraph (indented and shorter) .R on n return to Roman font .RE 5n y,y retreat: end level of relative indentation .RP x - n released paper format; x=no stops title on 1st page .RS 5n y,y right shift: start level of relative indentation .SH - y,y section header, in boldface .SM - n smaller; decrease point size by 2 .TA 8n,5n n set tabs to 8n 16n ... (nroff) 5n 10n ... (troff) .TC x - y print table of contents at end; x=no suppresses title .TE - y end of table processed by tbl .TH - y end multi-page header of table .TL - y title in boldface and two points larger .TM off n UC Berkeley thesis mode .TS x - y,y begin table; if x=H table has multi-page header .UL x - n underline x, even in troff .UX x - n UNIX; trademark message first time; x appended .XA x y - y another index entry; x=page or no for none; y=indent .XE - y end index entry (or series of .IX entries) .XP - y,y paragraph with first line exdented, others indented .XS x y - y begin index entry; x=page or no for none; y=indent .1C on y,y one column format, on a new page .2C - y,y begin two column format .]- - n beginning of refer reference .[0 - n end of unclassifiable type of reference .[N - n N= 1:journal-article, 2:book, 3:book-article, 4:report REGISTERS
Formatting distances can be controlled in -ms by means of built-in number registers. For example, this sets the line length to 6.5 inches: .nr LL 6.5i Here is a table of number registers and their default values: Name Register Controls Takes Effect Default PS point size paragraph 10 VS vertical spacing paragraph 12 LL line length paragraph 6i LT title length next page same as LL FL footnote length next .FS 5.5i PD paragraph distance paragraph 1v (if n), .3v (if t) DD display distance displays 1v (if n), .5v (if t) PI paragraph indent paragraph 5n QI quote indent next .QP 5n FI footnote indent next .FS 2n PO page offset next page 0 (if n), ~1i (if t) HM header margin next page 1i FM footer margin next page 1i FF footnote format next .FS 0 (1, 2, 3 available) When resetting these values, make sure to specify the appropriate units. Setting the line length to 7, for example, will result in output with one character per line. Setting FF to 1 suppresses footnote superscripting; setting it to 2 also suppresses indentation of the first line; and setting it to 3 produces an .IP-like footnote paragraph. Here is a list of string registers available in -ms; they may be used anywhere in the text: Name String's Function *Q quote (" in nroff, `` in troff ) *U unquote (" in nroff, '' in troff ) *- dash (-- in nroff, -- in troff ) *(MO month (month of the year) *(DY day (current date) ** automatically numbered footnote *' acute accent (before letter) *` grave accent (before letter) *^ circumflex (before letter) *, cedilla (before letter) *: umlaut (before letter) *~ tilde (before letter) When using the extended accent mark definitions available with .AM, these strings should come after, rather than before, the letter to be accented. BUGS
Floating keeps and regular keeps are diverted to the same space, so they cannot be mixed together with predictable results. 4th Berkeley Distribution October 23, 1996 MS(7)
All times are GMT -4. The time now is 09:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy