parsing output

I have a file that contains the output of the ls -iR command, something like this:

./results:
2504641011 result_1410 2500957642 result_525
2504641012 result_1425 2500957643 result_540

./tests/1:
2500788755 1 2500788743 1000

./tests/2:
2500788759 3 2500788758 999

I need to parse it so that I have the directory in one file and the fnames and inodes in another. How can I do this?

Thanks!

cat inp | egrep '^\.' > dirs.txt
cat inp | egrep -v '^\.' > files.t

This should create a file "dirs" with the directories and "files" with the files:

ls -iR | awk '/^\./{print > "dirs";next}NF{print > "files"}' 

That works great!
I need to use this in a Perl script, where I store the ls -iR output in a file and parse that file. If the line contains a directory, store it in a variable. If its a file name and inode, and if the inode is the same as some predefined value, then I need to use the inode and the dir_name. I have the code below, and obviously it doesnt work. Any idea why?

Thanks!

system "ls -iR > temp_inodes_fnames";
open(INO_FNAME, "temp_inodes_fnames") || die "File doesnt exist!";
open(FNAMES, ">>temp_filenames") || die "File doesnt exist!" ;
while($record = <INO_FNAME>){

if\($record =~ m/^\\ /i;\)
   $dir_name = $record;
\($inode,$fname\) = split \(' ', $record\);
if \( $inode == $my_inode\) \{
    
    print \($inode, "\\t", $fname, "\\t", $dir_name, "\\n"\);
\}

}
close(INO_FNAME);
close(FNAMES);

Off the bat, I don't see where $my_inode is being set, and the logic is unclear.

you want $savedir := <directory>
<inode> eq <myinode> then $fileinfo = <inode> + <dir>
else $fileinfo = <filename>

__--

I'm unclear also, I apologize, what are you trying to accomplish.

Are you trying to report on all filenames which match directory names, or are you searching for a particular inode value?

I need to know the complete path (directory and the filename) to those files whose inodes match a given set of values. Hence if the inodes match a value defined in a hashtable, I need the name of the file as well as the directory to which it belongs and store it in a file. I then read these files at a later stage in the script.

I havent the complete code as the other parts are irrelevant, hence the confusion, sorry about that! :o