Saturday, July 11, 2009

Windows unix cut command - column cut mode

The second part of the Windows Unix Cut command implements the column cut mode of the Cut command. By specifying flags such as -c for column cut mode and -p for entire file cut mode, the program can be used to cut the file based on column and file respectively.

This functionality is available in Editplus which offers column select option, but the command line tool can be very useful while cutting enormous files. The latest code is given below:

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class Cut {
public static void main(String[] args) throws IOException {
FileInputStream in = null;
FileOutputStream out = null;
try {
in = new FileInputStream(args[1]);
out = new FileOutputStream("cutoutput.txt");
if(args[0].equals("-p")){
int c,count=0,llim=Integer.parseInt(args[2]),ulim=Integer.parseInt(args[3]);
while ((c = in.read()) != -1) {
if((char)c=='\n'){
count =count-1;}
count++;
if(count>=llim && count<=ulim){
//System.out.println((char)c);
out.write(c);}
}
System.out.println("Total characters between range is "+(ulim-llim));
}
else if(args[0].equals("-c")){
int c,count=0,llim=Integer.parseInt(args[2]),ulim=Integer.parseInt(args[3]);
while ((c = in.read()) != -1) {
if((char)c=='\n'){
count =1;out.write('\n');/*System.out.println();*/}
count++;
if(count>=llim && count<=ulim){
//System.out.print((char)c);
out.write(c);}
}
System.out.println("Output to be viewed in Wordpad or higer only" );
}

} finally {
if (in != null) {
in.close();
}
if (out != null) {
out.close();
}
}
}
}

3 comments:

Anonymous said...

any updates coming ?

Anonymous said...

Unblock Faceblok easily applyung this qiicvkly, no cots proxies web siite. aPrtiicpate in Youtube movies even though in the home, scholo or work. [url=http://vpnserviceratings.com/unblock-youtube/]how to unblock youtube at school[/url]

Tujbnaliabwfaqq efMBkoepl

Anonymous said...

Method of production:
Viagra can cause serious side effects.
Sometimes, Viagra is not compatible with light drugs such as "poppers"
Kind of drug production
If you missed the reception Revatio, take it as soon as can. If you will soon receive the next pillbox on schedule, just remember that did not take the dose, but next time try to follow a systematic reception. Do not take the drug longer than the situation.

[url=http://cailis.webs.com/cheap-cialis-online-the-lowest-cialis-price-guaranteed.html]cheap cialis online the lowest cialis price guaranteed[/url][url=http://cailis.webs.com/buy-cialis-online-no-rx.html]buy cialis online no rx[/url][url=http://cailis.webs.com/cialis-online-without-prescription.html]cialis online without prescription[/url][url=http://voqudom.beesimple.co.uk/generic-cialis/cialis-online-cheap-from-canada.html]cialis online cheap from canada[/url][url=http://voqudom.beesimple.co.uk/cialis-super-active-plus/buy-cialis-online-uk.html]buy cialis online uk[/url][url=http://voqudom.beesimple.co.uk/cialis-super-active-plus/buy-cialis-online-overnight.html]buy cialis online overnight[/url][url=http://wohipew.beesimple.co.uk/cialis-super-active-plus/buy-cialis-online-mexico.html]buy cialis online mexico[/url][url=http://wohipew.beesimple.co.uk/generic-cialis/buy-cialis-auckland-nz.html]buy cialis auckland nz[/url][url=http://wohipew.beesimple.co.uk/generic-cialis/buy-cialis-london.html]buy cialis london[/url][url=http://cofidepe.bestnoise.com/how-to-purchase-cialis-online.html]how to purchase cialis online[/url][url=http://cofidepe.bestnoise.com/buy-cialis-in-usa.html]buy cialis in usa[/url][url=http://cofidepe.bestnoise.com/buy-viagra-cialis-online-australia.html]buy viagra cialis online australia[/url][url=http://ruqobihi.bestnoise.com/buy-cialis-very-cheap.html]buy cialis very cheap[/url][url=http://ruqobihi.bestnoise.com/buy-cialis-no-prescription-needed.html]buy cialis no prescription needed[/url][url=http://ruqobihi.bestnoise.com/cialis-daily-cost.html]cialis daily cost[/url]
[url=http://tevafeq.botetr.com/generic-cialis/cialis-price-comparison.html]cialis price comparison[/url][url=http://tevafeq.botetr.com/cialis-professional/best-online-pharmacy-for-cialis.html]best online pharmacy for cialis[/url][url=http://tevafeq.botetr.com/cialis-professional/cialis-4-hours.html]cialis 4 hours[/url][url=http://mihufow.botetr.com/cialis-professional/buy-cialis-online-ireland.html]buy cialis online ireland[/url][url=http://mihufow.botetr.com]buy cialis 10mg no prescription[/url][url=http://mihufow.botetr.com/cialis-super-active-plus/buy-cialis-very-cheap.html]buy cialis very cheap[/url][url=http://migepis.yk0.net/generic-cialis/buy-tadalafil-tablets-20mg.html]buy tadalafil tablets 20mg[/url][url=http://migepis.yk0.net/generic-cialis/buy-tadalafil-tablets-20mg.html]buy tadalafil tablets 20mg[/url][url=http://migepis.yk0.net/cialis-super-active-plus/buy-tadalafil-europe.html]buy tadalafil europe[/url][url=http://yuliqor.yk0.net/tadalafil-questions-answers.html]tadalafil questions answers[/url][url=http://yuliqor.yk0.net]tadalafil online canadian pharmacy[/url][url=http://yuliqor.yk0.net]tadalafil online canadian pharmacy[/url][url=http://cenutesa.i5ws.com/cialis-pills-super-active-soft.html]cialis pills super active soft[/url][url=http://cenutesa.i5ws.com/canadian-cialis-online-cheapest.html]canadian cialis online cheapest[/url][url=http://cenutesa.i5ws.com/cialis-tadalafil-information.html]cialis tadalafil information[/url]
Buy Cialis Online No RX