In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly shows you "how to extract content from different peers in batch processing". The content is easy to understand and clear. I hope it can help you solve your doubts. Let me lead you to study and learn the article "how to extract content from different peers in batch processing".
For instance:- for / f "delims=" an in (input.txt) do... For / f "delims=" an in ('type input.txt') do... For / f "delims=" an in ('more ^ < input.txt') do... However, only the last method (using the more command) will give consistent results across Windows NT, 2000, XP and 2003. The first method does not recognise unicode files. Also, the usebackq switch must be used if the input filename contains spaces. The second method, using the type command, also fails to recognise unicode files on Windows 2000, XP and 2003 if the input file does not begin with a bit order mark (BOM). In all the examples, assume the contents of of the file numbers.txt to be:- one two three four five six seven eight nine ten Displaying the first line This example prints one. Echo off & setlocal ENABLEEXTENSIONS set "first=" for / f "delims="% an in ('more ^ < numbers.txt') do (if not defined first set first=%%a) echo/%first% Displaying the first X lines This example prints one, two and three. @ echo off & setlocal ENABLEEXTENSIONS set "lines=3" set Illustrated do 1 set "ok=" for / f "delims="% an in ('more ^ < numbers.txt') do (set/an itemized colors 1 & for / f% z in (' echo/%%i%%') do (if "% z" = = "% lines%" set ok=1) if not defined ok echo/%%a) Displaying the last line This example prints ten. @ echo off & setlocal ENABLEEXTENSIONS for / f "delims="% an in ('more ^ < numbers.txt') do set "last=%%a" echo/%last% Displaying the last X lines This example prints nine and ten. Echo off & setlocal ENABLEEXTENSIONS set "lines=2" for / f% an in ('find/c / v "" ^ < numbers.txt') do set/a skip=%%a-lines for / f "delims="% an in (' more/e +% skip% ^ < numbers.txt') do (echo/%%a) Displaying the Nth line This example prints three. Note that instead of using the more command's / e switch, the skip option could have been used with the for / f command, however, this fails is it is set to any number less than one. Echo off & setlocal ENABLEEXTENSIONS set LineNo=3 set "line=" set/a LineNo-=1 for / f "delims="% an in ('more/e +% LineNo% ^ < numbers.txt') do (if not defined line set "line=%%a") echo/%line% Displaying the Nth line plus X number of lines This example prints five and six. @ echo off & setlocal ENABLEEXTENSIONS set start=5 set "lines=2" set/an Illuminati 1 Start-=1 set "ok=" for / f "delims="% an in ('more/e +% start% ^ < numbers.txt') do (set/an iComple1 & for / f% z in (' echo/%%i%%') do (if "% z" = = "% lines%" set ok=1) if not defined ok echo/%%a) all the contents of the article "how to extract content from different lines in batches" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.