Solved

perl split

Posted on 2013-12-28
2
200 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Title # Comments Views Activity
stftime format 4 58
Move Function in Perl Script 2 74
Regex rule to match two different url 5 75
Perl: How to add backslashes to every period in a string 1 49
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…

740 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