내가이 스크립트를하고 난 줄특정 라인
#! /bin/sh
# ==================================================================
# ______ __ _____
# /_ __/___ ____ ___ _________ _/ /_ /__/
#///__ \/ __ `__ \/ ___/ __ `/ __/ //
#////_/////// /__/ /_///_ //
#/_/ \____/_/ /_/ /_/\___/\__,_/\__/ /_/
HDK
# Multi-instance Apache Tomcat installation with a focus
# on best-practices as defined by Apache, SpringSource, and MuleSoft
# and enterprise use with large-scale deployments.
# Credits:
# Google -> Couldn't survive without it
# Stackoverflow.com -> Community support
# SpringSource -> Specifically best-practices and seminars (Expert Series)
SDK
# Based On:
# http://www.springsource.com/files/uploads/tomcat/tomcatx-performance-tuning.pdf
http://www.springsource.com/files/u1/PerformanceTuningApacheTomcat-Part2.pdf
# http://www.springsource.com/files/uploads/tomcat/tomcatx-large-scale-deployments.pdf
당 SDK 텍스트 라인과 라인에 도움을 주시기 바랍니다 HDK 텍스트 라인에서 라인을 추출 할로 시작하는 파일을 읽어보세요! 내가
public class ScannerExample {
public static void main(String args[]) throws FileNotFoundException {
//creating File instance to reference text file in Java
File text = new File("E:\\file.txt");
//Creating Scanner instnace to read File in Java
Scanner scnr = new Scanner(text);
//Reading each line of file using Scanner class
int lineNumber = 1;
int lineNumber1 = 1;
int numinf = 1;
int numsup=1;
while(scnr.hasNextLine()){
String line = scnr.nextLine();
if (line.contains("HDK")){numinf=lineNumber;
System.out.println(numinf);
}
if (line.contains("SDK")){numsup=lineNumber;
System.out.println(numsup);}
lineNumber++;
}
Scanner scnr1 = new Scanner(text);
while(scnr1.hasNextLine()){
String line = scnr.nextLine();
if (lineNumber>numinf){
System.out.println("line " + lineNumber + " :" + line);}
lineNumber1++;
}
}
}
을 시도했지만 그것은 작동하지 않았고 난이 메도보다 더 사용하여 파일을 탐색 묶고 내가 바란 영역에서 readnig을 제한 할 수 있습니다!
StackOverflow에 오신 것을 환영합니다. 코드를 묻는 질문은 해결 된 문제에 대해 최소한의 이해를 보여 주어야합니다. 시도한 해결책, 실패한 이유 및 예상되는 결과를 포함시킵니다. 또한 : [Stack Overflow question checklist] (http://meta.stackexchange.com/questions/156810/stack-overflow-question-checklist) –