It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
Create 10000 text file with DOS with text
so filename will be 1.txt and inside of it will be "numeric1.txt"
and the next text file will be 2.txt and inside of it will be "numeric2.txt"
...
and the next text file will be 10.txt and inside of it will be "numeric10.txt"
.
.
.
.
until the last text file will be 10000.txt and inside of it will be "numeric10000.txt"
Can you please help me with that ?
Regards
Update for this question
How I can make it write all this lines (with same number of files and file name like above)
#echo
cd..
cd..
cd /folder
text -u text -w numeric1.txt
FOR /L %A IN (1,1,10000) DO echo numeric%A.txt>%A.txt
#echo OFF
FOR /L %%G IN (1,1,10000) DO echo numeric%%G.txt > %%G.txt
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have a folder in which jpgs are created. When a new JPG is created, I need to resize it (to 2048x2048 pixels for instance) and convert it to a .dds (dxt1). All of this automatically.
I started to Google batch file commands, then understood that it would probably be better to use powershell and found out about ImageMagick converter. But I'm not sure of any of this and don't know where to begin...
I am no expert on Windows BATCH, but you can do something along these lines. Save the following code as JPG2DDS.BAT and run it using
JPG2DDS
or by double-clicking it.
#ECHO OFF
REM Start of infinite loop monitoring directory for JPGs
:TOP
echo Checking for files...
REM Work through all JPEG files converting to DDS
FOR /F %%f IN ( 'DIR /B *.JPG' ) DO (
ECHO Processing file %%f...
convert "%%f" -resize 2048x2048 "%%f.dds"
REM If it worked, rename the original file so we don't do it again
REM If it didn't work, we'll try again next time round
IF %ERRORLEVEL% == 0 (
ECHO Conversion successful
REN "%%f" "%%f.converted"
)
)
REM Sleep so as not to overload Windows
ECHO Sleeping...
SLEEP 10
GOTO TOP
All the commands above are described with examples here.
The convert command is part of ImageMagick which you will need to install. Before you run this script, make sure that you can convert a single JPEG to DDS using a command like this:
convert someImage.jpg -resize 2048x2048 result.dds
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
In Emacs, how does one rename a directory in dired-mode?
In dired, if you select a file and type 'R', you'll get a prompt under the modeline which will guide you through renaming the file. This works for files in general, including directories.
In general to explore dired-mode you can use C-h m and will get a useful summary
for example :
Type u to Unmark a file or all files of an inserted subdirectory.
Type DEL to back up one line and unmark or unflag.
Type x to delete (eXecute) the files flagged 'D'.
Type RET to Find the current line's file (or dired it in another buffer, if it is a directory).
Type o to find file or dired directory in Other window.
Type i to Insert a subdirectory in this buffer.
Type R to Rename a file or move the marked files to another directory.
Type C to Copy files.
Type s to toggle Sorting by name/date or change the `ls' switches.
Type g to read all currently expanded directories aGain. This retains all marks and hides subdirs again that were hidden before. Use SPC' andDEL' to move down and up by lines.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I would like a batch that reads a file called ships.txt, then takes the entries (each on a line) from that file and compares them to a file with the file extension of *.map (say test.map), looking for the match, which will always be at the end of a line. Then take those coordinates (they will be a pair of numbers that are actually long. and lat. in meters) and plug those coordinates into a perl script, which produces a file. I'd like then to read the file that is produced by the perl script and delete an entry that is found within another file using information from the perl script by-product.
Lets start from scratch. One step at a time
Step 1:
I would like a batch that compares "test.map" and "ships.txt". If it finds a match, and the match will always be at the end of a line in test.map, I'd like it to grab map coordinates.
This is what test.map will look like:
Code:
Pt0=14497903.00,-813490.00,0.00,Mark 1
Pt1=14417253.00,-812258.00,0.00,Mark 2
etc...
ships.txt will look something like this:
Mark 1
Mark 3
etc...
So I'd like the batch to read ships.txt and be looking for the entry "Mark 1" or "Mark 2" etc..., and if it is found in test.map, to grab the coordinates just before the ",0.00,Mark #" Notice the coordinates have two decimal places and they can also be negative.
How is this done?
Here is how it could be done.
Here is how you could open a file for read or write in perl. Then you have to read the files, line by line. Maybe it is better to use text::csv to read the files.
Use split or text::csv to create array from the first file lines, and store it in a hash, key should the last field of that file.
When you iterate over the second file, you could use this hash to check it in the first file or not.
Then write your result to a file.
Try to write your code and if you have a specific question you could create a new one.
Or you could hire someone to do this for you.
Regards
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
I never learned Perl and try to understand a piece written by someone else. Could someone tell me what perl -pi.bak -e "tr/\n\r/ /d" test.XML means? Thanks in advance.
perl -pi.bak -e "tr/\n\r/ /d" test.XML
-p read input from argument file or standard input (implicit while loop around program)
-i.bak perform in-place edit on argument file and save a copy with extension .bak.
-e the code
tr/\n\r/ /d transliterate all characters in the left hand side \n\r to their corresponding character in the right hand side (a space), and /d delete any entries which do not have a corresponding character.
So basically this will take the file test.XML, store a copy in test.XML.bak, change all newlines to space, delete all line feed characters \r, and save this copy as test.XML.
Be aware that you can overwrite backups by running this command multiple times. The backup is not backed up.
Briefly, it's executing the script following -e for each line of the input file test.XML. It then writes the modifications back to the input file and retains the original file with a .bak suffix. I would create a sample XML file and try it out. You'll see that your original file is modified (check the filesystem dates) and the original retained with the .bak suffix.
The tr function is documented here, and translates characters. The above is manipulating carriage-returns/line-feeds.
The -p and -i arguments let Perl rename the input file such that it's retained as a backup of the original. See perlrun for more details.
See here for more tips/tricks relating to Perl one-liners.
It changes the newlines in test.XML to be spaces. It will also backup the original file as test.XML.bak.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I am newbie to perl, I would like to write a perl script to read in multiple text files and look for string and copy the line containing string to an spreadsheet.
Ex: I want to open file csv.txt and look for string "Color" in each line and copy the line to a spread sheet
Color: Name any color
From this line I want to copy Name any color to spreadsheet.
Thanks
For starter: Read CSV file you could use Text:Csv.
http://metacpan.org/pod/Text::CSV
Nice tutorial: http://perlmaven.com/how-to-read-a-csv-file-using-perl
You could use simple regexp to find every line:
if ($line =~ m!Color!){
#do things if $line contain this word
}
You could write a new excel file with this module: Excel::Writer::XLSX
http://metacpan.org/pod/Excel::Writer::XLSX
I you still have a trouble, close this question, create a new one and do not forget to include your code there: https://stackoverflow.com/questions/how-to-ask