Přidat otázku mezi oblíbenéZasílat nové odpovědi e-mailem windows script - odstraneni komentaru

Ahoj, chtel jsem si udelat jednoduchy skript, ktery by mi v configu odstanil radky ktere obsahuji #
Jenze bud mi to nebere celz radek, anebo naopak zmiyi treba mezery.
Poradi mi prosim nekdo ? Diky

Tady je skript:

echo off
set /p soubor="Zadejte jmeno celeho souboru: "
ren %soubor% %soubor%.old


for /f "tokens=1,2,3,4,5,6,7,8,9 delims=?" %%a in (%soubor%.old) do call :SUB %%a
goto exit

:SUB

echo %1%2%3%4%5%6%7%8%9>tmp.dat
find /i "#" "tmp.dat"
cls
echo "%1%2%3%4%5%6%7%8%9"
if %errorlevel% NEQ 0 Echo %1%2%3%4%5%6%7%8%9>> %soubor%
goto :EOF

:exit

A tady je kus yml:

#These are Global Settings for Residence.
Global:
    # This loads the <language>.yml file in the Residence Language folder
    # All Residence text comes from this file. (NOT DONE YET)
    Language: Czech
    # Wooden Axe is the default selection tool for Residence.
    # You can change it to another item ID listed here: [url]www.minecraftwiki.net/wiki/Data_values[/url]
    SelectionToolId: 271
    # This determins which tool you can use to see info on residences, default is String.
    # Simply equip this tool and hit a location inside the residence and it will display the info for it.
    InfoToolId: 287
    # The interval, in milliseconds, between movement checks.
    # Reducing this will increase the load on the server.
    # Increasing this will allow players to move further in movement restricted zones before they are teleported out.
    MoveCheckInterval: 500
    # The interval, in minutes, between residence saves.
    SaveInterval: 5
    # The default group to use if Permissions fails to attach or your not using Permissions.
    DefaultGroup: default
    # Enable / Disable the Lease System.
    UseLeaseSystem: Enable
    # The interval, in minutes, between residence lease checks (if leases are enabled).
    LeaseCheckInterval: 10
    # Allows leases to automatically renew so long as the player has the money, if economy is disabled, this setting does nothing.
    LeaseAutoRenew: true
    # Whether or not to use the Permissions system in conjunction with this config.
    EnablePermissions: true
    # Set to true if NOT using Permissions or PermissionsBukkit, or using a really old version of Permissions
    LegacyPermissions: false
    # Enable / Disable Residence's Economy System (iConomy, MineConomy, Essentials, BOSEconomy, and RealEconomy supported).
    EnableEconomy: true
    # Enables or disables the Rent System
    EnableRentSystem: true
    # The interval, in minutes, between residence rent expiration checks (if the rent system is enabled).
    RentCheckInterval: 10
    # Enable or disable residence chat channels.
    ResidenceChatEnable: true
    # Color of residence chat.
    ResidenceChatColor: DARK_PURPLE
    # Whether or not to ignore the usual Permission flags and only allow OPs and groups with 'residence.admin' to change residences.
    AdminOnlyCommands: false
    # Setting this to true makes server OPs admins.
    AdminOPs: true
    # This is the name of the plugin you use for multiworld, if you dont have a multiworld plugin you can safely ignore this.
    # The only thing this does is check to make sure the multiworld plugin is enabled BEFORE Residence, to ensure properly loading residences for other worlds.
    MultiWorldPlugin: Multiverse-Core
    # Setting this to true causes subzones to inherit flags from their parent zones.
    ResidenceFlagsInherit: true
    # Setting this to false will allow rented residences to be modified by the renting player.
    PreventRentModify: true
    # Setting this to false will cause residence to continue to load even if a error is detected in the save file.
    StopOnSaveFault: true
Předmět Autor Datum
Použi vbs: www.visualbasicscript.com
pme 18.05.2013 11:19
pme
zkusil jsem pozit ten skript, ale nejak mi to nebeha
martimb 18.05.2013 11:29
martimb
type původní_souborek.txt | find /v "#" > souborek_bez_komentů.txt pokud jde o odfiltrování jen těc…
lední brtník 18.05.2013 14:08
lední brtník
Super dekuji moc poslední
martimb 18.05.2013 14:35
martimb
type původní_souborek.txt | find /v "#" > souborek_bez_komentů.txt

pokud jde o odfiltrování jen těch řádků, kde jsou divné znaky na prvním místě, chce to regulár:

type původní_souborek.txt | findstr /r "^[a-z]" > souborek_bez_komentů.txt

(ošetři i na čísla a velká písmena)

Zpět do poradny Odpovědět na původní otázku Nahoru