Created
June 18, 2021 15:04
-
-
Save gr33n7007h/2c326f5da73e32402dbc5cabdf9cab99 to your computer and use it in GitHub Desktop.
aiyion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env lua | |
local std = require'posix.unistd' | |
local sio = require'posix.stdio' | |
local rd, wr = std.pipe() | |
std.write(wr, "foo\nbar\nbaz\nfood") | |
std.close(wr) | |
local file = sio.fdopen(rd, 'r') | |
for line in file:lines() do | |
if line:match("foo") then | |
print(line) | |
end | |
end | |
file:close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment