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
CP1252(7)						     Linux Programmer's Manual							 CP1252(7)

NAME
cp1252 - CP 1252 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 1252 encodes the char- acters used in many West European languages. CP 1252 characters The following table displays the characters in CP 1252, which are printable and unlisted in the ascii(7) manual page. Oct Dec Hex Char Description -------------------------------------------------------------------- 200 128 80 EUR EURO SIGN 202 130 82 , SINGLE LOW-9 QUOTATION MARK 203 131 83 f LATIN SMALL LETTER F WITH HOOK 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 MODIFIER LETTER CIRCUMFLEX ACCENT 211 137 89 %o PER MILLE SIGN 212 138 8A LATIN CAPITAL LETTER S WITH CARON 213 139 8B < SINGLE LEFT-POINTING ANGLE QUOTATION MARK 214 140 8C OE LATIN CAPITAL LIGATURE OE 216 142 8E LATIN CAPITAL LETTER Z WITH CARON 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 SMALL TILDE 231 153 99 tm TRADE MARK SIGN 232 154 9A LATIN SMALL LETTER S WITH CARON 233 155 9B > SINGLE RIGHT-POINTING ANGLE QUOTATION MARK 234 156 9C oe LATIN SMALL LIGATURE OE 236 158 9E LATIN SMALL LETTER Z WITH CARON 237 159 9F LATIN CAPITAL LETTER Y WITH DIAERESIS 240 160 A0 NO-BREAK SPACE 241 161 A1 i INVERTED EXCLAMATION MARK 242 162 A2 c CENT SIGN 243 163 A3 L POUND SIGN 244 164 A4 x CURRENCY SIGN 245 165 A5 Y YEN SIGN 246 166 A6 | BROKEN BAR 247 167 A7 S SECTION SIGN 250 168 A8 " DIAERESIS 251 169 A9 (C) COPYRIGHT SIGN 252 170 AA a FEMININE ORDINAL INDICATOR 253 171 AB << LEFT-POINTING DOUBLE ANGLE QUOTATION MARK 254 172 AC ~ NOT SIGN 255 173 AD SOFT HYPHEN 256 174 AE (_) REGISTERED SIGN 257 175 AF MACRON 260 176 B0 o DEGREE SIGN 261 177 B1 +- PLUS-MINUS SIGN 262 178 B2 2 SUPERSCRIPT TWO 263 179 B3 3 SUPERSCRIPT THREE 264 180 B4 ' ACUTE ACCENT 265 181 B5 u MICRO SIGN 266 182 B6 9| PILCROW SIGN 267 183 B7 . MIDDLE DOT 270 184 B8 , CEDILLA 271 185 B9 1 SUPERSCRIPT ONE 272 186 BA o MASCULINE ORDINAL INDICATOR 273 187 BB >> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK 274 188 BC 1/4 VULGAR FRACTION ONE QUARTER 275 189 BD 1/2 VULGAR FRACTION ONE HALF 276 190 BE 3/4 VULGAR FRACTION THREE QUARTERS 277 191 BF c INVERTED QUESTION MARK 300 192 C0 A LATIN CAPITAL LETTER A WITH GRAVE 301 193 C1 A LATIN CAPITAL LETTER A WITH ACUTE 302 194 C2 A LATIN CAPITAL LETTER A WITH CIRCUMFLEX 303 195 C3 A LATIN CAPITAL LETTER A WITH TILDE 304 196 C4 A LATIN CAPITAL LETTER A WITH DIAERESIS 305 197 C5 A LATIN CAPITAL LETTER A WITH RING ABOVE 306 198 C6 AE LATIN CAPITAL LETTER AE 307 199 C7 C LATIN CAPITAL LETTER C WITH CEDILLA 310 200 C8 E LATIN CAPITAL LETTER E WITH GRAVE 311 201 C9 E LATIN CAPITAL LETTER E WITH ACUTE 312 202 CA E LATIN CAPITAL LETTER E WITH CIRCUMFLEX 313 203 CB E LATIN CAPITAL LETTER E WITH DIAERESIS 314 204 CC I LATIN CAPITAL LETTER I WITH GRAVE 315 205 CD I LATIN CAPITAL LETTER I WITH ACUTE 316 206 CE I LATIN CAPITAL LETTER I WITH CIRCUMFLEX 317 207 CF I LATIN CAPITAL LETTER I WITH DIAERESIS 320 208 D0 D LATIN CAPITAL LETTER ETH 321 209 D1 N LATIN CAPITAL LETTER N WITH TILDE 322 210 D2 O LATIN CAPITAL LETTER O WITH GRAVE 323 211 D3 O LATIN CAPITAL LETTER O WITH ACUTE 324 212 D4 O LATIN CAPITAL LETTER O WITH CIRCUMFLEX 325 213 D5 O LATIN CAPITAL LETTER O WITH TILDE 326 214 D6 O LATIN CAPITAL LETTER O WITH DIAERESIS 327 215 D7 x MULTIPLICATION SIGN 330 216 D8 O LATIN CAPITAL LETTER O WITH STROKE 331 217 D9 U LATIN CAPITAL LETTER U WITH GRAVE 332 218 DA U LATIN CAPITAL LETTER U WITH ACUTE 333 219 DB U LATIN CAPITAL LETTER U WITH CIRCUMFLEX 334 220 DC U LATIN CAPITAL LETTER U WITH DIAERESIS 335 221 DD Y LATIN CAPITAL LETTER Y WITH ACUTE 336 222 DE b LATIN CAPITAL LETTER THORN 337 223 DF B LATIN SMALL LETTER SHARP S 340 224 E0 a LATIN SMALL LETTER A WITH GRAVE 341 225 E1 a LATIN SMALL LETTER A WITH ACUTE 342 226 E2 a LATIN SMALL LETTER A WITH CIRCUMFLEX 343 227 E3 a LATIN SMALL LETTER A WITH TILDE 344 228 E4 a LATIN SMALL LETTER A WITH DIAERESIS 345 229 E5 a LATIN SMALL LETTER A WITH RING ABOVE 346 230 E6 ae LATIN SMALL LETTER AE 347 231 E7 c LATIN SMALL LETTER C WITH CEDILLA 350 232 E8 e LATIN SMALL LETTER E WITH GRAVE 351 233 E9 e LATIN SMALL LETTER E WITH ACUTE 352 234 EA e LATIN SMALL LETTER E WITH CIRCUMFLEX 353 235 EB e LATIN SMALL LETTER E WITH DIAERESIS 354 236 EC i LATIN SMALL LETTER I WITH GRAVE 355 237 ED i LATIN SMALL LETTER I WITH ACUTE 356 238 EE i LATIN SMALL LETTER I WITH CIRCUMFLEX 357 239 EF i LATIN SMALL LETTER I WITH DIAERESIS 360 240 F0 o LATIN SMALL LETTER ETH 361 241 F1 n LATIN SMALL LETTER N WITH TILDE 362 242 F2 o LATIN SMALL LETTER O WITH GRAVE 363 243 F3 o LATIN SMALL LETTER O WITH ACUTE 364 244 F4 o LATIN SMALL LETTER O WITH CIRCUMFLEX 365 245 F5 o LATIN SMALL LETTER O WITH TILDE 366 246 F6 o LATIN SMALL LETTER O WITH DIAERESIS 367 247 F7 -:- DIVISION SIGN 370 248 F8 o LATIN SMALL LETTER O WITH STROKE 371 249 F9 u LATIN SMALL LETTER U WITH GRAVE 372 250 FA u LATIN SMALL LETTER U WITH ACUTE 373 251 FB u LATIN SMALL LETTER U WITH CIRCUMFLEX 374 252 FC u LATIN SMALL LETTER U WITH DIAERESIS 375 253 FD y LATIN SMALL LETTER Y WITH ACUTE 376 254 FE b LATIN SMALL LETTER THORN 377 255 FF y LATIN SMALL LETTER Y WITH DIAERESIS NOTES
CP 1252 is also known as Windows-1252. SEE ALSO
ascii(7), charsets(7), iso_8859-1(7), iso_8859-15(7), utf-8(7) Linux 2014-10-16 CP1252(7)
All times are GMT -4. The time now is 03:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy