🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.perl
Article #39760

Re: Wyciąganie danych z pliku

#39760
From: Szymon Sokół
Date: Mon, 18 Oct 2004 15:04
18 lines
1925 bytes
tomjas <tomjas@wytnijtopoczta.onet.pl> wrote:
: >> ale jak pozbyć się z początku znaków X(n)= to nie mam zielonego pojęcia.
: > 
: > uzyc regexa? np. tak:
: > perl -ne "print $1 if /X\(\n+\)=(.*)/" plik>wyniki
: > 
: Niestety nie działa. Tzn wykonuje się bez błedu ale tworzy pusty plik.
No to zamiast kombinować po znikowemu zrób to po ludzku:

perl -nle 'if(s/^X\(\d+\)=//){for$x(split" "){printf "%10f",$x}}' we>wy 
(zakładam, że składnia tych linii z danymi jest dokładnie taka, jak
napisałeś, tj. napis "X(1)=" nie zawiera żadnych spacji).

-- 
Szymon Sokół (SS316-RIPE) -- Network Manager                                B
Computer Center, AGH - University of Science and Technology, Cracow, Poland O
http://home.agh.edu.pl/szymon/ PGP key id: RSA: 0x2ABE016B, DSS: 0xF9289982 F 
Free speech includes the right not to listen, if not interested -- Heinlein H
Technical Details
Message-ID: <cl0m1e$i0r$1@galaxy.uci.agh.edu.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!news.onet.pl!agh.edu.pl!news.agh.edu.pl!not-for-mail
References: <slrn.pl.cn6mjp.mcv.tomjas@perrun.ha1rtr.agh.edu.pl> <ckvo6p$hra$1@news.lublin.pl> <slrn.pl.cn7ite.3jr.tomjas@perrun.ha1rtr.agh.edu.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!news.onet.pl!agh.edu.pl!news.agh.edu.pl!not-for-mail
From: Szymon Sokół
 <szymon@bastard.operator.from.hell.pl>
Newsgroups: pl.comp.lang.perl
Subject: Re: Wyciąganie danych z pliku
Date: Mon, 18 Oct 2004 15:04:14 +0000 (UTC)
Organization: University of Mining & Metallurgy
Lines: 18
Sender: Szymon Sokol <szymon@galaxy.uci.agh.edu.pl>
Message-ID: <cl0m1e$i0r$1@galaxy.uci.agh.edu.pl>
References: <slrn.pl.cn6mjp.mcv.tomjas@perrun.ha1rtr.agh.edu.pl> <ckvo6p$hra$1@news.lublin.pl> <slrn.pl.cn7ite.3jr.tomjas@perrun.ha1rtr.agh.edu.pl>
NNTP-Posting-Host: galaxy.uci.agh.edu.pl
Mime-Version: 1.0
X-Trace: galaxy.uci.agh.edu.pl 1098111854 18459 149.156.96.9 (18 Oct 2004 15:04:14 GMT)
X-Complaints-To: usenet@uci.agh.edu.pl
NNTP-Posting-Date: Mon, 18 Oct 2004 15:04:14 +0000 (UTC)
User-Agent: tin/1.6.2-20030910 ("Pabbay") (UNIX) (SunOS/5.8 (sun4u))
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit