Comments (8)
You could write lua scripts to do this.
Lua is much more powerful than grub2 bash-like scripts.
from grub.
It doesn't seem to have the io module for io.open, etc.
I think there is some file support...
-- globals.lua
-- show all global variables
local seen={}
function dump(t,i)
seen[t]=true
local s={}
local n=0
for k in pairs(t) do
n=n+1 s[n]=k
end
table.sort(s)
for k,v in ipairs(s) do
print(i,v)
v=t[v]
if type(v)=="table" and not seen[v] then
dump(v,i.."\t")
end
end
end
dump(_G,"")
e.g. but I have no idea how to use it.
I want to open the file
read in a line
use gsub to replace a string
write the line to another file (can be an existing file)
on an NTFS or FAT32 volume.
?? any hints please when you have time ??
from grub.
please upload you xml file, I will write an example tomorrow.
from grub.
infull.zip
That is very kind of you, thank you. I have never used lua and there seems to be no mention of 'file_getline' on Google for lua???
So I want to replace (in this example) all occurences of 'UNAME' with 'steve' and 'PCNAME' with 'ComputerA'
So a function like repl "searchstr" "replacestr" infile outfile
would be ideal
Note that the file has < and > and ! characters!
from grub.
abc.zip
Extract it to (hd0,1)/
and run lua (hd0,1)/write.lua
from grub.
abcd.zip
Extract it to (hd0,1)/
and run lua (hd0,1)/write.lua
from grub.
Thank you so much!
That had the examples I needed and I now have it working. :-) 💯
from grub.
That had the examples I needed and I now have it working. :-) 100
I forgot to run grub.file_close
.Please add it.
file1 = grub.file_open ("(tar)/test.xml")
file2 = grub.file_open ("(tar)/empty.xml", "w")
uname = read_input ("UNAME")
pcname = read_input ("PCNAME")
search_replace (file1, file2, {"UNAME", "PCNAME"}, {uname, pcname})
grub.file_close (file1)
grub.file_close (file2)
from grub.
Related Issues (20)
- 截屏模块 和 某些命令 的问题。 HOT 12
- Request: Disable menu 'c' and 'e' hotkeys HOT 6
- put nointegritychecks to OSLOADER HOT 1
- add an option to load bootvhd.dll (i386-pc/ntboot)
- Load SeaBIOS/TianoCore HOT 1
- Question: dd status=progress? HOT 8
- getkey key codes for Ctrl+Shift+F HOT 20
- 为什么ntboot不支持光盘? HOT 1
- Ignore floppies
- 在Ubuntu18.04 x86_64中编译aarch64 HOT 1
- menuentry --help-msg buggy HOT 10
- Query: Are variables in a theme .txt file supported? HOT 2
- NTBOOT 没有启动动画 HOT 8
- wimboot BIOS fails for WinPE WIMs larger than 890MB HOT 10
- how to build HOT 1
- set fallback=1 it not work? HOT 1
- GRUB does not create menu entries
- Request adding support for zstd compressed squashfs files.
- What changes can be upstreamed? HOT 13
- Wimboot.mod in UEFI mode loads only first image in wim file when index is not 1. HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grub.