Solved

perl split

Posted on 2013-12-28
2
203 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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

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 …
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
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…
Six Sigma Control Plans

635 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