Solved

perl split

Posted on 2013-12-28
2
201 Views
Last Modified: 2014-01-07
I have x numbers of file which has named with same algorithm

[root@sflow snmpstatus]# ls -l
total 20
-rw-r--r-- 1 root root  675 Dec 28 13:00 K16.Result.28-12-2013-13-00-04.txt
-rw-r--r-- 1 root root  720 Dec 28 13:00 K17.Result.28-12-2013-13-00-04.txt
-rw-r--r-- 1 root root 1015 Dec 28 13:00 ROUTER.Result.28-12-2013-13-00-04.txt
-rw-r--r-- 1 root root  697 Dec 28 13:00 T01.Result.28-12-2013-13-00-04.txt
-rw-r--r-- 1 root root 2201 Dec 28 13:00 T01.stat1.28-12-2013-13-00-04.txt

Open in new window


before the first dat there are names like K16 K17 ....

1 up 1000
2 up 1000
3 up 1000
4 up 1000
5 up 1000
6 up 1000
7 down 1000
8 up 1000
9 up 1000
10 up 1000
11 up 1000
12 up 1000
13 down 1000
14 down 1000
15 down 1000
16 down 1000
17 down 1000
18 down 1000
19 down 1000
20 down 1000
21 down 1000
22 down 1000
23 up 100
24 down 1000
25 up 100
26 down 1000
27 down 1000
28 down 1000
29 down 1000
30 down 1000
31 down 1000
32 down 1000
33 up 1000
34 up 1000
35 up 1000
36 up 100
37 up 1000
38 down 1000
39 up 1000
40 up 1000
41 down 1000
42 up 1000
43 up 1000
44 up 1000
45 down 1000
46 down 1000
47 down 1000
48 up 1000
1000 notPresent 0
1001 notPresent 0
1002 notPresent 0
1003 notPresent 0
1004 notPresent 0
1005 notPresent 0
1006 notPresent 0
1007 notPresent 0
100000 up 0

Open in new window



And they al have some includes like that so i want to split them write to line by line like that


K16 1 up  1000
K16 2 up  1000
....
K17 1 up  1000
....


how should i do it ?
0
Comment
Question by:3XLcom
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 500 total points
ID: 39743369
If you are reading <> or <ARGV>, the name of the file will be in $ARGV
0
 

Author Closing Comment

by:3XLcom
ID: 39762528
sorry thank you
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question