Skip to content

Instantly share code, notes, and snippets.

@gr33n7007h
Created June 18, 2021 15:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gr33n7007h/2c326f5da73e32402dbc5cabdf9cab99 to your computer and use it in GitHub Desktop.
Save gr33n7007h/2c326f5da73e32402dbc5cabdf9cab99 to your computer and use it in GitHub Desktop.
aiyion
#!/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