szukałem z wyrażeniami regularnymi, ale nie bardzo moge sie połapać...
kiedys widzialem tutaj na forum cos takiego ze mozna wyciągnąc z tekstu dany ciąg znaków i go przypisac jakies stalej ale nie moge tego znalezc
chodzi mi o to ze np. plik ps.out zawiera w sobie:
PID TTY STAT TIME COMMAND 1 ? S 0:00 init [2] 2 ? S 0:00 [keventd] 3 ? SN 0:00 [ksoftirqd_CPU0] 4 ? S 1:05 [kswapd] 5 ? S 0:00 [bdflush] 6 ? S 0:00 [kupdated] 99 ? S 0:05 [kjournald] 505 ? S 0:00 [khubd] 594 ? Ss 0:17 dhclient -e -pf /var/run/dhclient.eth0.pid -lf /var/run/dhclient.eth0.leases eth0 600 ? Ss 0:00 /sbin/portmap 754 ? Ss 0:03 /sbin/syslogd 757 ? Ss 0:00 /sbin/klogd 804 ? Ss 0:00 /usr/sbin/exim4 -bd -q30m 810 ? Ss 0:00 /usr/sbin/inetd 821 ? Ss 0:01 /usr/sbin/sshd 826 ? Ss 0:00 /sbin/rpc.statd 829 ? Ss 0:00 /usr/sbin/atd 832 ? Ss 0:00 /usr/sbin/cron 849 tty1 Ss+ 0:00 -bash 850 tty2 Ss+ 0:00 /sbin/getty 38400 tty2 851 tty3 Ss+ 0:00 /sbin/getty 38400 tty3 852 tty4 Ss+ 0:00 /sbin/getty 38400 tty4 853 tty5 Ss+ 0:00 /sbin/getty 38400 tty5 854 tty6 Ss+ 0:00 /sbin/getty 38400 tty6 934 ? Ss 0:00 /usr/sbin/vsftpd 1577 ? Ss 0:00 /usr/sbin/named -u bind 1578 ? S 0:00 /usr/sbin/named -u bind 1579 ? S 0:00 /usr/sbin/named -u bind 1580 ? S 0:00 /usr/sbin/named -u bind 1581 ? S 0:00 /usr/sbin/named -u bind 4959 ? S 0:00 /bin/sh /usr/bin/mysqld_safe 4995 ? S 0:00 /bin/sh /usr/bin/mysqld_safe 4996 ? S 0:01 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock 4997 ? S 0:00 logger -p daemon.err -t mysqld_safe -i -t mysqld 5000 ? S 0:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock 5001 ? S 0:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock 5002 ? S 0:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock 5003 ? S 0:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock 5004 ? S 0:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock 5005 ? S 0:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock 5006 ? S 0:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock 5007 ? S 0:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock 5008 ? S 0:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock 5184 ? Ss 0:00 SCREEN irssi 5185 pts/2 Ss+ 0:17 irssi 7255 ? S 0:01 /usr/sbin/apache 7446 ? Ss 0:00 SCREEN -m -d 7447 pts/3 Ss+ 0:00 /bin/sh 13392 ? S 0:43 ping onet.pl 13394 ? S 0:43 ping onet.pl 13433 ? S 0:44 ping onet.pl 14251 ? S 0:00 /bin/sh ./hlds_run -autoupdate -game cstrike +maxplayers 4 +map de_dust2 +ip 62.121.99.110 +port 27018 +exec server.cfg 14582 ? S 4:24 ./hlds_i686 -autoupdate -game cstrike +maxplayers 4 +map de_dust2 +ip 62.121.99.110 +port 27018 +exec server.cfg 14588 ? S 0:00 ./hlds_i686 -autoupdate -game cstrike +maxplayers 4 +map de_dust2 +ip 62.121.99.110 +port 27018 +exec server.cfg 14589 ? S 0:01 ./hlds_i686 -autoupdate -game cstrike +maxplayers 4 +map de_dust2 +ip 62.121.99.110 +port 27018 +exec server.cfg 15422 ? Ss 0:00 /usr/sbin/vsftpd 15423 ? S 0:33 /usr/sbin/vsftpd 16240 ? S 0:00 /usr/sbin/apache 16241 ? S 0:00 /usr/sbin/apache 16242 ? S 0:00 /usr/sbin/apache 16243 ? S 0:00 /usr/sbin/apache 16244 ? S 0:00 /usr/sbin/apache 16496 ? Ss 0:00 /usr/sbin/lpd -s 18783 ? Ss 0:00 sshd: modern [priv] 18785 ? S 0:00 sshd: modern [priv] 18787 ? S 0:00 sshd: modern@notty 18788 ? Ss 0:00 /usr/lib/sftp-server 18833 ? Ss 0:00 sshd: modern [priv] 18835 ? S 0:00 sshd: modern [priv] 18842 ? S 0:00 sshd: modern@pts/0 18843 pts/0 Ss+ 0:00 -bash 18907 ? S 0:00 /usr/sbin/apache 18941 ? R 0:00 ps ax
i chce wybrać z tego pliku wszystkie wiersze które mają w sobie to, a konkretnie tylko pierwszych 5 znaków czyli ich ID... tzn czasami jest tych znakó wiecej lub mniej... wiec moze wybrac od początku wierszu az do pierwszej spacji:
./hlds_i686 -autoupdate -game cstrike +maxplayers 4 +map de_dust2 +ip 62.121.99.110 +port 27018 +exec server.cfg
Probowalem ze strpos ale wiecej z tym zabawy niz efektów jakie by mnie zadowoliły

Prosze o pomoc