W
wdandrews1
/* Remove.c
** Usage: remove < In_file > Out_file (using redirection)
*/
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
char c;
int space = 0;
for(c = fgetc(stdin); !feof(stdin); c = fgetc(stdin)){
if((c !=' ')&&(space == 0)) /* start from beginning of line reading
in characters */
{
continue; /* we wan't to discard 'ii ' from beginning of line */
}
if(c ==' '){ /* space found, so increment counter */
space++;
}
if((space == 1)&&(space != 2)){ /* one space found so far... */
fputc(c, stdout); /* start printing characters until we reach
the second space */
}
if(space == 2){ /* second space found */
fputc('\r', stdout); /* mark as end of line */
space = 0; /* reset space counter */
}
if((space >= 2)&&(c !='\r')){ /* we don't need rest of line to the
'\r' mark */
continue; /* get rid of versions, descriptions, ect. */
}
}
return 0; /* we've read the entire file at this point, so we're at
the end */
}
/
**************************************(CUT)*******************************************
I'm using the linux GCC 4.2.1 Compiler. I also have the Borland
V5.02.
This is only a very short sample of the KNOPPIX LINUX LIVE DVD
packages description.
I need to strip the 'ii ' at the beginning, the version, and package
description.
What's needed is the package name ONLY, so that I can edit the list
to create
a 'KICK LIST file.
The output file should be like:
-------------------------------------------------------------------------------------------
Own
aalib-bin
aalib1
ace-of-penguins
acpi
adduser
........
........
........
and so on.
----------------------------------------------------------------------------------------------
Any Suggestions would be welcomed.
Thanks in advance,
Wayne Andrews
packages.txt
||=NAME======VERSION============PACKAGE
DESCRIPTION==================||
ii 0wn 0.1-1 0wn - Knoppix
installer
ii aalib-bin 1.4p5-22 sample programs
using aalib
ii aalib1 1.4p5-28 ascii art
library - transitional package
ii ace-of-penguins 1.2-8 Solitaire-games
with penguin-look
ii acpi 0.09-1 displays
information on ACPI devices
ii adduser 3.101 Add and remove
users and groups
ii adtool 1.2-3 command line
utility for Active Directory administration
ii aespipe 2.3b-4 AES-encryption
tool with loop-AES support
ii afio 2.5-4 archive file
manipulation program
ii airsnort 0.2.7e-2 WLAN sniffer
ii alevt 1.6.1-7.1 X11 Teletext/
Videotext browser
ii alien 8.64 install non-
native packages with dpkg
ii alsa-base 1.0.13-2 ALSA driver
configuration files
ii alsa-utils 1.0.13-1 ALSA utilities
ii amanda-client 2.5.1p1-2.1 Advanced
Maryland Automatic Network Disk Archiver (Client)
ii amanda-common 2.5.1p1-2.1 Advanced
Maryland Automatic Network Disk
*/
** Usage: remove < In_file > Out_file (using redirection)
*/
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
char c;
int space = 0;
for(c = fgetc(stdin); !feof(stdin); c = fgetc(stdin)){
if((c !=' ')&&(space == 0)) /* start from beginning of line reading
in characters */
{
continue; /* we wan't to discard 'ii ' from beginning of line */
}
if(c ==' '){ /* space found, so increment counter */
space++;
}
if((space == 1)&&(space != 2)){ /* one space found so far... */
fputc(c, stdout); /* start printing characters until we reach
the second space */
}
if(space == 2){ /* second space found */
fputc('\r', stdout); /* mark as end of line */
space = 0; /* reset space counter */
}
if((space >= 2)&&(c !='\r')){ /* we don't need rest of line to the
'\r' mark */
continue; /* get rid of versions, descriptions, ect. */
}
}
return 0; /* we've read the entire file at this point, so we're at
the end */
}
/
**************************************(CUT)*******************************************
I'm using the linux GCC 4.2.1 Compiler. I also have the Borland
V5.02.
This is only a very short sample of the KNOPPIX LINUX LIVE DVD
packages description.
I need to strip the 'ii ' at the beginning, the version, and package
description.
What's needed is the package name ONLY, so that I can edit the list
to create
a 'KICK LIST file.
The output file should be like:
-------------------------------------------------------------------------------------------
Own
aalib-bin
aalib1
ace-of-penguins
acpi
adduser
........
........
........
and so on.
----------------------------------------------------------------------------------------------
Any Suggestions would be welcomed.
Thanks in advance,
Wayne Andrews
packages.txt
||=NAME======VERSION============PACKAGE
DESCRIPTION==================||
ii 0wn 0.1-1 0wn - Knoppix
installer
ii aalib-bin 1.4p5-22 sample programs
using aalib
ii aalib1 1.4p5-28 ascii art
library - transitional package
ii ace-of-penguins 1.2-8 Solitaire-games
with penguin-look
ii acpi 0.09-1 displays
information on ACPI devices
ii adduser 3.101 Add and remove
users and groups
ii adtool 1.2-3 command line
utility for Active Directory administration
ii aespipe 2.3b-4 AES-encryption
tool with loop-AES support
ii afio 2.5-4 archive file
manipulation program
ii airsnort 0.2.7e-2 WLAN sniffer
ii alevt 1.6.1-7.1 X11 Teletext/
Videotext browser
ii alien 8.64 install non-
native packages with dpkg
ii alsa-base 1.0.13-2 ALSA driver
configuration files
ii alsa-utils 1.0.13-1 ALSA utilities
ii amanda-client 2.5.1p1-2.1 Advanced
Maryland Automatic Network Disk Archiver (Client)
ii amanda-common 2.5.1p1-2.1 Advanced
Maryland Automatic Network Disk
*/