Sponsored Content
Top Forums Shell Programming and Scripting AWK/GREP: grep only lines starting with integer Post 302625111 by chrisjorg on Tuesday 17th of April 2012 09:47:26 AM
Old 04-17-2012
AWK/GREP: grep only lines starting with integer

I have an input file

Code:
12.4 1.72849432773174e+01 -7.74784188610632e+01
12.5 9.59432114416327e-01 -7.87018212757537e+01
15.6 5.20139995965960e-01 -5.61612429666624e+01
29.3 3.76696387248366e+00 -7.42896194101892e+01
32.1 1.86899877018077e+01 -7.56508762501408e+01
35 6.98857157014640e+00 -6.47719177518354e+01
57.5 9.93224752487084e+00 -5.98507250538671e+01
59.5 1.17880137446671e+01 -6.70358856818233e+01
59.6 3.39353476095376e+00 -5.85719268969042e+01
64.6 1.39100633884576e+01 -7.89068504596848e+01
66.1 3.29754641066104e+00 -6.11126946124472e+01
68.3 1.34614891224838e+01 -7.96561570561526e+01
75.2 1.27732250188725e+00 -7.98537412569579e+01
75.7 1.81103716761368e+01 -7.96494146285998e+01
79.6 6.16383337522536e+00 -6.29030439858399e+01
92.8 1.52331049249522e+01 -6.51748608352182e+01
94.6 7.26150084491214e+00 -6.93621024271574e+01
100.1 1.68539103307157e+01 -7.85748993775416e+01
100.9 3.52929142412477e+00 -6.86640757476861e+01
101 1.62464294145481e+00 -6.12247635460096e+01
101.1 1.67667000571671e+01 -7.60963191396523e+01
109.1 1.89539766434845e+01 -3.22357460422950e+01
124.2 5.77306017328185e+00 -7.74816073271627e+01
124.3 1.62709216276807e-01 -6.38710866726218e+01
124.4 1.62418063967260e+00 -5.06164124324214e+01
124.5 1.15920020337606e+00 -5.39562951251459e+01
127.5 1.63638664576208e+01 -7.53341787458119e+01

I want to grep only lines that start with an integer number,

any recommendations?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

awk or grep for integer only

how do you print the lines that contain integers only, using grep or awk? thanks , apalex ------------------ this file below: qwerty 01234 asdfgh 01234 qwer12 asdf05 will be: 01234 01234 qwer12 asdf05 (5 Replies)
Discussion started by: apalex
5 Replies

2. Shell Programming and Scripting

MEM=`ps v $PPID| grep -i db2 | grep -v grep| awk '{ if ( $7 ~ " " ) { print 0 } else

Hi Guys, I need to set the value of $7 to zero in case $7 is NULL. I've tried the below command but doesn't work. Any ideas. thanks guys. MEM=`ps v $PPID| grep -i db2 | grep -v grep| awk '{ if ( $7 ~ " " ) { print 0 } else { print $7}}' ` Harby. (4 Replies)
Discussion started by: hariza
4 Replies

3. UNIX for Dummies Questions & Answers

retrieve lines using sed, grep or awk

Hi, I'm looking for a command to retrieve a block of lines using sed or grep, probably awk if that can do the job. In below example, By searching for words "Third line2" i'm expecting to retrieve the full block starting with 'BEGIN' and ending with 'END' of the search. Example: ... (3 Replies)
Discussion started by: learning_linux
3 Replies

4. Shell Programming and Scripting

use awk pick value from lines as condition for grep

Hi Folks! I have a file like this 000000006 dist:0.0 FILE ./MintRoute/MultiHopWMEWMA.nc LINE:305:1 NODE_KIND:131 nVARs:4 NUM_NODE:66 TBID:733 TEID:758 000000000 dist:0.0 FILE ./Route/MultiHopLEPSM.nc LINE:266:1 NODE_KIND:131 nVARs:4 NUM_NODE:66 TBID:601 TEID:626 000000001 ... (2 Replies)
Discussion started by: jackoverflow
2 Replies

5. UNIX for Dummies Questions & Answers

grep/awk and bring multiple lines forward

Hello all, I have a question regarding grep and pulling the result forward to the next carriage return or line space. Sorry if I have terminology incorrect. I have the following data set. Line1 Line2 Line3 Line5 Line6 Line7 Line9 Line10 Line11 I would like to grep for a pattern... (5 Replies)
Discussion started by: klysdale
5 Replies

6. Shell Programming and Scripting

Problems to print specific lines with awk and grep...HELP!

Hi all I have data like this: model: 1, misfit value: 0.74987 1 1.182 1.735 2.056 1.867 2 0.503 1.843 2.018 1.888 3 2.706 2.952 2.979 1.882 4 8.015 3.414 3.675 1.874 ... (1 Reply)
Discussion started by: fedora2011
1 Replies

7. Shell Programming and Scripting

grep/awk to only print lines with two columns in a file

Hey, Need some help for command to print only lines with two columns in a file abc 111 cde 222 fgh ijk 2 klm 12 23 nop want the ouput to be abc 111 cde 222 ijk 2 Thanks a lot in advance!!! (3 Replies)
Discussion started by: leo.maveriick
3 Replies

8. UNIX for Dummies Questions & Answers

Grep -v lines starting with pattern 1 and not matching pattern 2

Hi all! Thanks for taking the time to view this! I want to grep out all lines of a file that starts with pattern 1 but also does not match with the second pattern. Example: Drink a soda Eat a banana Eat multiple bananas Drink an apple juice Eat an apple Eat multiple apples I... (8 Replies)
Discussion started by: demmel
8 Replies

9. Shell Programming and Scripting

Grep a string and count following lines starting with another string

I have a large dataset with following structure; C 0001 Carbon D SAR001 methane D SAR002 ethane D SAR003 propane D SAR004 butane D SAR005 pentane C 0002 Hydrogen C 0003 Nitrogen C 0004 Oxygen D SAR011 ozone D SAR012 super oxide C 0005 Sulphur D SAR013... (3 Replies)
Discussion started by: Syeda Sumayya
3 Replies

10. UNIX for Dummies Questions & Answers

How to grep a line not starting with # from a file (there are two lines starting with # and normal)?

e.g. File name: File.txt cat File.txt Result: #INBOUND_QUEUE=FAQ1 INBOUND_QUEUE=FAQ2 I want to get the value for one which is not commented out. Thanks, (3 Replies)
Discussion started by: Tanu
3 Replies
ASCII(7)						     Linux Programmer's Manual							  ASCII(7)

NAME
ascii - the ASCII character set encoded in octal, decimal, and hexadecimal DESCRIPTION
ASCII is the American Standard Code for Information Interchange. It is a 7-bit code. Many 8-bit codes (such as ISO 8859-1, the Linux default character set) contain ASCII as their lower half. The international counterpart of ASCII is known as ISO 646. The following table contains the 128 ASCII characters. C program 'X' escapes are noted. Oct Dec Hex Char Oct Dec Hex Char ------------------------------------------------------------ 000 0 00 NUL '' 100 64 40 @ 001 1 01 SOH 101 65 41 A 002 2 02 STX 102 66 42 B 003 3 03 ETX 103 67 43 C 004 4 04 EOT 104 68 44 D 005 5 05 ENQ 105 69 45 E 006 6 06 ACK 106 70 46 F 007 7 07 BEL 'a' 107 71 47 G 010 8 08 BS '' 110 72 48 H 011 9 09 HT ' ' 111 73 49 I 012 10 0A LF ' ' 112 74 4A J 013 11 0B VT 'v' 113 75 4B K 014 12 0C FF 'f' 114 76 4C L 015 13 0D CR ' ' 115 77 4D M 016 14 0E SO 116 78 4E N 017 15 0F SI 117 79 4F O 020 16 10 DLE 120 80 50 P 021 17 11 DC1 121 81 51 Q 022 18 12 DC2 122 82 52 R 023 19 13 DC3 123 83 53 S 024 20 14 DC4 124 84 54 T 025 21 15 NAK 125 85 55 U 026 22 16 SYN 126 86 56 V 027 23 17 ETB 127 87 57 W 030 24 18 CAN 130 88 58 X 031 25 19 EM 131 89 59 Y 032 26 1A SUB 132 90 5A Z 033 27 1B ESC 133 91 5B [ 034 28 1C FS 134 92 5C '\' 035 29 1D GS 135 93 5D ] 036 30 1E RS 136 94 5E ^ 037 31 1F US 137 95 5F _ 040 32 20 SPACE 140 96 60 ` 041 33 21 ! 141 97 61 a 042 34 22 " 142 98 62 b 043 35 23 # 143 99 63 c 044 36 24 $ 144 100 64 d 045 37 25 % 145 101 65 e 046 38 26 & 146 102 66 f 047 39 27 ' 147 103 67 g 050 40 28 ( 150 104 68 h 051 41 29 ) 151 105 69 i 052 42 2A * 152 106 6A j 053 43 2B + 153 107 6B k 054 44 2C , 154 108 6C l 055 45 2D - 155 109 6D m 056 46 2E . 156 110 6E n 057 47 2F / 157 111 6F o 060 48 30 0 160 112 70 p 061 49 31 1 161 113 71 q 062 50 32 2 162 114 72 r 063 51 33 3 163 115 73 s 064 52 34 4 164 116 74 t 065 53 35 5 165 117 75 u 066 54 36 6 166 118 76 v 067 55 37 7 167 119 77 w 070 56 38 8 170 120 78 x 071 57 39 9 171 121 79 y 072 58 3A : 172 122 7A z 073 59 3B ; 173 123 7B { 074 60 3C < 174 124 7C | 075 61 3D = 175 125 7D } 076 62 3E > 176 126 7E ~ 077 63 3F ? 177 127 7F DEL HISTORY
An ascii manual page appeared in Version 7 AT&T UNIX. On older terminals, the underscore code is displayed as a left arrow, called backarrow, the caret is displayed as an up-arrow and the ver- tical bar has a hole in the middle. Uppercase and lowercase characters differ by just one bit and the ASCII character 2 differs from the double quote by just one bit, too. That made it much easier to encode characters mechanically or with a non-microcontroller-based electronic keyboard and that pairing was found on old teletypes. The ASCII standard was published by the United States of America Standards Institute (USASI) in 1968. SEE ALSO
iso_8859_1(7), iso_8859_15(7), iso_8859_7(7) Linux 1999-08-08 ASCII(7)
All times are GMT -4. The time now is 10:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy