Help with parsing a CSV file

Another project. :cry:

I need to parse a csv file to a formatted text file for my dhcp list.

All ops on THIS machine.

THIS THIS.

I tried - and failed - to read the file from my home directory. (Which is kind of good)
So I put it in my node-red/public directory.

But still can't get to it.

In the read file node, what do I need to put?

I do access other files on this machine but for reasons unknown, it isn't working.

I shall buzz off and check - again.
But I fear I will more help further down the line anyway.
So may as well ask now.
:wink:

Ok, I stuffed up with HOW to get the filename to the node.

Got that working.

Now I'm working on how to ..... split up the rows/columns and sort of get them back to cells then parse the cells and output another text file.

I'll edit some of the data and post a bit of it to show - as I can't expect you to know it.

But that's where I'm at now.

Part of the file.

,,,,,,,,,,,,,,
,,,,,,,,,,,,,,
,,,,,,DO NOT EDIT,,,,,,,,
,,,,,,,,,,,,,,
,,,,,,,,,,,,,,
,17,MAIN,,,12,MEDIA,,,13,WINDOWS,,,16,STORAGE
IP,Device,MAC,,IP,Device,MAC,,IP,Device,MAC,,IP,Device,MAC
1,Router,,,1,Router,,,1,Router,,,1,Router,
2,Switch,MAC,,2,Switch,MAC,,2,Switch,28-87-BA-F3-B9-43,,2,Switch,MAC
3,Linksys,,,3,,,,3,,,,3,,
4,TP 1016,MAC,,4,,,,4,,,,4,,
5,,,,5,Shield,MAC:7e,,5,,,,5,WIB,
6,NUC,NAC,,6,TIVX,MAC,,6,,,,6,The Shed,MAC
7,Nas-T-Nuc,,,7,Beyonwiz,FAULTY?,,7,,,,7,Outhouse,MAC
8,,,,8,,,,8,,,,8,BARN (eth2),90:09:D0:4A:B5:64
9,TV,MAC,,9,,,,9,,,,9,(moved to MEDIA network),
10,,,,10,,,,10,,,,10,,
11,,,,11,,,,11,Big P.C.,MAC,,
12,,,,12,,,,12,Printer,30:05:5c:4e:72:0c,,12,,
13,,,,13,,,,13,Blacksheep,PENDING,,13,,
14,,,,14,,,,14,Other P.C.,PENDING,,14,,
15,,,,15,,,,15,,,,15,,
16,,,,16,,,,16,,,,16,,
17,,,,17,,,,17,,,,17,,
18,,,,18,,,,18,,,,18,,
19,,,,19,,,,19,,,,19,,
20,,,,20,,,,20,,,,20,,
21,XBMC,MAC,,21,,,,21,,,,21,,
22,MusicPi,MAC,,22,,,,22,,,,22,,
23,BedPi,MAC,,23,,,,23,,,,23,,
24,IR Bridge,MAC,,24,,,,24,,,,24,,
25,,,,25,,,,25,,,,25,,
26,PiFace,,,26,,,,26,,,,26,,
27,,,,27,,,,27,,,,27,,
28,,,,28,,,,28,,,,28,,
29,,,,29,,,,29,,,,29,,
30,EyeSpyPi,,,30,,,,30,,,,30,,
31,CameraPi,,,31,,,,31,,,,31,,
32,PortaPi,MAC,,32,,,,32,,,,32,,
33,TelePi,MAC,,33,,,,33,,,,33,,
34,BeefPi,MAC,,34,,,,34,,,,34,,
35,,,,35,,,,35,,,,35,,
36,,,,36,,,,36,,,,36,,
37,,,,37,,,,37,,,,37,,
38,,,,38,,,,38,,,,38,,
39,TimePi,MAC,,39,,,,39,,,,39,,
40,,,,40,,,,40,,,,40,,
41,,,,41,,,,41,,,,41,,
42,,,,42,,,,42,,,,42,,

I want to extract the IP, MAC and Name.

Help please.

This looks like a difficult file to parse.

There are only three lines containing a MAC address, and those are not all in the same column.
I don't see any IP addresses at all.

Where does the file come from?
I'd probably try and rationalise the contents before struggling to parse it.

1 Like

Thanks.

Sometimes I surprise myself.

Yes,a lot of messing around but I got it working.

SORRY.

But all good.

I only did a small part as it is/was painful masking all the MAC addresses.
(Privacy and all that)

It is a spreadsheet I made and need to extract all the assigned IP addresses because of things recently happened.