Sponsored Content
Top Forums Shell Programming and Scripting Find a pattern and print next all character to next space Post 302416358 by pierrebjarnfelt on Monday 26th of April 2010 08:38:34 AM
Old 04-26-2010
Hi agian,

sorry but I have tried everything so here are a pice of my orignal file.

Code:
i3421 cisco_2960 ty-3 *IP=148.138.210.226 *NM=typ_2960_ty_3 *CDP3 *sv1 *login_typass l_090212 
i5432 cisco_2950 ty-3 *CDP3 *IP=148.138.210.9 *NM=typ_2950_ty_5 *sv1 *login_typass  l_0211xx
i3465 cisco_2950 ty-3 *CDP3 *NM=typ_2950_ty_6 *IP=148.138.210.10  *sv1 *login_typass  l_0211xx
i2342 cisco_2950 ty-3 *  CDP3 *IP=148.138.211.204 *NM=typ_2950_ty_11 *sv1 *login_typass l_050105 
i7653 cisco_2960 ty-3 *CDP3  *IP=148.138.210.18 *NM=typ_2960_ty_2 *sv1 *login_typass l_090212 
i1234 cisco_29608 ty-3  *NM=typ_29608_ty_1 *IP=148.138.203.112 *sv1 *login_typass l_080930 
i6342 cisco_29608 ty-3 *IP=148.138.203.113 *NM=typ_29608_ty_2 *sv1 *login_typass l_080930

I have tried to use the following combinations to solve it.
Code:
sed -n "s/.*\*IP=\([^ ]*\) .*$/\1/p" result.txt
sed -n "s/.*\*IP=\([^ ]*\) .//p" result.txt

The closest I get is this
Code:
NM=typ_2960_ty_3 *CDP3 *sv1 *login_typass l_0
NM=typ_2960_ty_2 *sv1 *login_typass l_090212
sv1 *login_typass l_080930
NM=typ_29608_ty_2 *sv1 *login_typass l_080930

I'm using Windows XP Pro. SP3 with UnxUtils.

/Pierre
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to print range of lines using sed when pattern has special character "["

Hi, My input has much more lines, but few of them are below pin(IDF) { direction : input; drc_pinsigtype : signal; pin(SELDIV6) { direction : input; drc_pinsigtype : ... (3 Replies)
Discussion started by: nehashine
3 Replies

2. Shell Programming and Scripting

Print characters till the next space when the pattern is found

i have a file which contains alphanumeric data in every line. what i need is the data after certain pattern. the data after the pattern is not of fixed length so i need the data till the space after the pattern. Input file: bfdkasfbdfg khffkf lkdhfhdf pattern (datarequired data not required)... (2 Replies)
Discussion started by: gpk_newbie
2 Replies

3. Shell Programming and Scripting

Find pattern in file and print

Hello, I want to read a CSV file and look for a pattern on each line. If the pattern is found I want to read another portion/column of that line and print that. Can somebody help me in writing it in CSH? E.g. CSV file has following lines, 1,Elephant,500kg,,,,, 2,Tiger,50kg,,,,,... (4 Replies)
Discussion started by: deshiashish
4 Replies

4. Shell Programming and Scripting

Print pattern regardless of space between

I have this content in file sshd : ALL : allow SSHD : all : ALLOW sshD : All : AllOW What I need is to print the occurrence of "sshd:all" regardless of the spaces between them and if lower/upper case. So all lines should be printed in output when "grepped" or "printed... (3 Replies)
Discussion started by: anil510
3 Replies

5. Shell Programming and Scripting

Print character after pattern found

Hi Gurus, i need your help to create a script the will print a characters after the pattern was found. Sample lines are below: My birthday:"1977-16-07", My birthday:"1975-16-07" My birthday:"1970-16-07". My patter should be "birthday:", then i want to print the following characters which... (18 Replies)
Discussion started by: scripter123
18 Replies

6. Shell Programming and Scripting

Gawk Find Pattern Print Lines Before and After

Using grep I can easily use: cvs log |grep -iB 10 -A 10 'date: 2013-10-30' to display search results and 10 lines before and after. How can this be accompished using gawk? (4 Replies)
Discussion started by: metallica1973
4 Replies

7. Shell Programming and Scripting

Find key pattern and print selected lines for each record

Hi, I need help on a complicated file that I am working on. I wanted to extract important info from a very huge file. It is space delimited file. I have hundred thousands of records in this file. An example content of the inputfile as below:- ## ID Ser402 Old; 23... (2 Replies)
Discussion started by: redse171
2 Replies

8. Shell Programming and Scripting

sed -- Find pattern -- print remainder -- plus lines up to pattern -- Minus pattern

The intended result should be : PDF converters 'empty line' gpdftext and pdftotext?xml version="1.0"?> xml:space="preserve"><note-content version="0.1" xmlns:/tomboy/link" xmlns:size="http://beatniksoftware.com/tomboy/size">PDF converters gpdftext and pdftotext</note-content>... (9 Replies)
Discussion started by: Klasform
9 Replies

9. Post Here to Contact Site Administrators and Moderators

Search for a pattern and replace a space at specific position with a Character in File

In file, we have millions of records each of 1000 in length. And at specific position say 800 there is a space, we need to replace it with Character X if the ID in that row starts with 123. So far i have used the below which is replacing space at that position to X but its not checking for... (3 Replies)
Discussion started by: Jagmeet Singh
3 Replies

10. UNIX for Beginners Questions & Answers

Find matched pattern and print all based on certain conditions

Hi, I am trying to extract data based on certain conditions. My sample input file as below:- lnc-2:1 OnePiece tra_law 500 688 1 . . g_id "R792.8417"# tra_law_id "R792.8417.1"# g_line "2.711647"# KM "8.723820"# lnc-2:1 OnePiece room 500 510 1 . . g_id "R792.8417"# tra_law_id "R792.8417.1"#... (7 Replies)
Discussion started by: bunny_merah19
7 Replies
CP1251(7)						     Linux Programmer's Manual							 CP1251(7)

NAME
cp1251 - CP 1251 character set encoded in octal, decimal, and hexadecimal DESCRIPTION
The Windows Code Pages include several 8-bit extensions to the ASCII character set (also known as ISO 646-IRV). CP 1251 encodes the char- acters used in Cyrillic scripts. The following table displays the characters in CP 1251, which are printable and unlisted in the ascii(7) manual page. The fourth column will only show the proper glyphs in an environment configured for CP 1251. Oct Dec Hex Char Description ---------------------------------------------------------------------- 200 128 80 CYRILLIC CAPITAL LETTER DJE 201 129 81 CYRILLIC CAPITAL LETTER GJE 202 130 82 , SINGLE LOW-9 QUOTATION MARK 203 131 83 CYRILLIC SMALL LETTER GJE 204 132 84 ,, DOUBLE LOW-9 QUOTATION MARK 205 133 85 HORIZONTAL ELLIPSIS 206 134 86 - DAGGER 207 135 87 = DOUBLE DAGGER 210 136 88 EUR EURO SIGN 211 137 89 %o PER MILLE SIGN 212 138 8A CYRILLIC CAPITAL LETTER LJE 213 139 8B < SINGLE LEFT-POINTING ANGLE QUOTATION MARK 214 140 8C CYRILLIC CAPITAL LETTER NJE 215 141 8D CYRILLIC CAPITAL LETTER KJE 216 142 8E CYRILLIC CAPITAL LETTER TSHE 217 143 8F CYRILLIC CAPITAL LETTER DZHE 220 144 90 CYRILLIC SMALL LETTER DJE 221 145 91 ' LEFT SINGLE QUOTATION MARK 222 146 92 ' RIGHT SINGLE QUOTATION MARK 223 147 93 " LEFT DOUBLE QUOTATION MARK 224 148 94 " RIGHT DOUBLE QUOTATION MARK 225 149 95 o BULLET 226 150 96 - EN DASH 227 151 97 -- EM DASH 230 152 98 UNDEFINED 231 153 99 tm TRADE MARK SIGN 232 154 9A CYRILLIC SMALL LETTER LJE 233 155 9B > SINGLE RIGHT-POINTING ANGLE QUOTATION MARK 234 156 9C CYRILLIC SMALL LETTER NJE 235 157 9D CYRILLIC SMALL LETTER KJE 236 158 9E CYRILLIC SMALL LETTER TSHE 237 159 9F CYRILLIC SMALL LETTER DZHE 240 160 A0 NO-BREAK SPACE 241 161 A1 CYRILLIC CAPITAL LETTER SHORT U 242 162 A2 CYRILLIC SMALL LETTER SHORT U 243 163 A3 CYRILLIC CAPITAL LETTER JE 244 164 A4 x CURRENCY SIGN 245 165 A5 CYRILLIC CAPITAL LETTER GHE WITH UPTURN 246 166 A6 | BROKEN BAR 247 167 A7 S SECTION SIGN 250 168 A8 CYRILLIC CAPITAL LETTER IO 251 169 A9 (C) COPYRIGHT SIGN 252 170 AA CYRILLIC CAPITAL LETTER UKRAINIAN IE 253 171 AB << LEFT-POINTING DOUBLE ANGLE QUOTATION MARK 254 172 AC ~ NOT SIGN 255 173 AD SOFT HYPHEN 256 174 AE (R) REGISTERED SIGN 257 175 AF CYRILLIC CAPITAL LETTER YI 260 176 B0 o DEGREE SIGN 261 177 B1 +- PLUS-MINUS SIGN 262 178 B2 CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I 263 179 B3 CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I 264 180 B4 CYRILLIC SMALL LETTER GHE WITH UPTURN 265 181 B5 u MICRO SIGN 266 182 B6 9| PILCROW SIGN 267 183 B7 . MIDDLE DOT 270 184 B8 CYRILLIC SMALL LETTER IO 271 185 B9 NUMERO SIGN 272 186 BA CYRILLIC SMALL LETTER UKRAINIAN IE 273 187 BB >> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK 274 188 BC CYRILLIC SMALL LETTER JE 275 189 BD CYRILLIC CAPITAL LETTER DZE 276 190 BE CYRILLIC SMALL LETTER DZE 277 191 BF CYRILLIC SMALL LETTER YI 300 192 C0 CYRILLIC CAPITAL LETTER A 301 193 C1 CYRILLIC CAPITAL LETTER BE 302 194 C2 CYRILLIC CAPITAL LETTER VE 303 195 C3 CYRILLIC CAPITAL LETTER GHE 304 196 C4 CYRILLIC CAPITAL LETTER DE 305 197 C5 CYRILLIC CAPITAL LETTER IE 306 198 C6 CYRILLIC CAPITAL LETTER ZHE 307 199 C7 v CYRILLIC CAPITAL LETTER ZE 310 200 C8 CYRILLIC CAPITAL LETTER I 311 201 C9 CYRILLIC CAPITAL LETTER SHORT I 312 202 CA CYRILLIC CAPITAL LETTER KA 313 203 CB CYRILLIC CAPITAL LETTER EL 314 204 CC CYRILLIC CAPITAL LETTER EM 315 205 CD CYRILLIC CAPITAL LETTER EN 316 206 CE CYRILLIC CAPITAL LETTER O 317 207 CF CYRILLIC CAPITAL LETTER PE 320 208 D0 CYRILLIC CAPITAL LETTER ER 321 209 D1 CYRILLIC CAPITAL LETTER ES 322 210 D2 CYRILLIC CAPITAL LETTER TE 323 211 D3 CYRILLIC CAPITAL LETTER U 324 212 D4 CYRILLIC CAPITAL LETTER EF 325 213 D5 CYRILLIC CAPITAL LETTER HA 326 214 D6 CYRILLIC CAPITAL LETTER TSE 327 215 D7 CYRILLIC CAPITAL LETTER CHE 330 216 D8 CYRILLIC CAPITAL LETTER SHA 331 217 D9 CYRILLIC CAPITAL LETTER SHCHA 332 218 DA CYRILLIC CAPITAL LETTER HARD SIGN 333 219 DB CYRILLIC CAPITAL LETTER YERU 334 220 DC CYRILLIC CAPITAL LETTER SOFT SIGN 335 221 DD CYRILLIC CAPITAL LETTER E 336 222 DE CYRILLIC CAPITAL LETTER YU 337 223 DF CYRILLIC CAPITAL LETTER YA 340 224 E0 CYRILLIC SMALL LETTER A 341 225 E1 CYRILLIC SMALL LETTER BE 342 226 E2 CYRILLIC SMALL LETTER VE 343 227 E3 CYRILLIC SMALL LETTER GHE 344 228 E4 CYRILLIC SMALL LETTER DE 345 229 E5 CYRILLIC SMALL LETTER IE 346 230 E6 CYRILLIC SMALL LETTER ZHE 347 231 E7 CYRILLIC SMALL LETTER ZE 350 232 E8 CYRILLIC SMALL LETTER I 351 233 E9 CYRILLIC SMALL LETTER SHORT I 352 234 EA CYRILLIC SMALL LETTER KA 353 235 EB CYRILLIC SMALL LETTER EL 354 236 EC CYRILLIC SMALL LETTER EM 355 237 ED CYRILLIC SMALL LETTER EN 356 238 EE CYRILLIC SMALL LETTER O 357 239 EF CYRILLIC SMALL LETTER PE 360 240 F0 CYRILLIC SMALL LETTER ER 361 241 F1 CYRILLIC SMALL LETTER ES 362 242 F2 CYRILLIC SMALL LETTER TE 363 243 F3 CYRILLIC SMALL LETTER U 364 244 F4 CYRILLIC SMALL LETTER EF 365 245 F5 CYRILLIC SMALL LETTER HA 366 246 F6 CYRILLIC SMALL LETTER TSE 367 247 F7 CYRILLIC SMALL LETTER CHE 370 248 F8 CYRILLIC SMALL LETTER SHA 371 249 F9 CYRILLIC SMALL LETTER SHCHA 372 250 FA CYRILLIC SMALL LETTER HARD SIGN 373 251 FB CYRILLIC SMALL LETTER YERU 374 252 FC CYRILLIC SMALL LETTER SOFT SIGN 375 253 FD CYRILLIC SMALL LETTER E 376 254 FE CYRILLIC SMALL LETTER YU 377 255 FF CYRILLIC SMALL LETTER YA NOTES
CP 1251 is also known as Windows Cyrillic. SEE ALSO
ascii(7) COLOPHON
This page is part of release 3.44 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2010-09-20 CP1251(7)
All times are GMT -4. The time now is 12:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy