我想用" ' "插入一个字符串作为多个文件中的特殊字符。我要插入的所有文件都有一行,之后我想执行INSERT。
例如:
INSERT之前的文件:
...
FROM FROM LOCAL:LOAD_FILE
被拒绝的数据:REJECT_PATH
...
在INSERT之后文件:
...
FROM FROM LOCAL:LOAD_FILE
DELIMITER AS' |'
被拒绝的数据:REJECT_PATH
...
我尝试写下许多SED命令,但它们会产生错误。其中之一是:
sed' LOAD_FILE / a / DELIMITER AS \' \ | \' / g'来源> DESTINATION
答案 0 :(得分:1)
PcapHandle handle = Pcaps.openOffline("/path/to/your.pcap");
while (true) {
try {
Packet packet = handle.getNextPacketEx();
Dot11ProbeRequestPacket probe = packet.get(Dot11ProbeRequestPacket.class);
if (probe == null) { continue; }
byte[] mgmtFrame = ByteArrays.getSubArray(
probe.getRawData(),
probe.getHeader().getFrameControl().isOrder() ? 28 : 24
);
System.out.println(ByteArrays.toHexString(mgmtFrame, ""));
} catch (EOFException e) {
break;
} catch (PcapNativeException | TimeoutException | NotOpenException e) {
e.printStackTrace();
}
}
handle.close();
答案 1 :(得分:0)
使用周围的双引号:
sed "/FROM LOCAL :LOAD_FILE/s//&\nDELIMITER AS '|'/" file
或单引号(更安全以避免不必要的变量扩展):
sed '/FROM LOCAL :LOAD_FILE/s//&\nDELIMITER AS '"'|'"'/' file
答案 2 :(得分:0)
另一种表达方式:
String[] arguments = new String[]{"QA01", "ATC", "WCOCO", "WZR3", "SCAL"};
for(int i=0; i<arguments.length; i++){
//your query code
result[i] = "select Release_name,cycle_name,BG_bu_id from <Table Name> where <column_name> ="+arguments[i];
}
关于我使用的语法:
答案 3 :(得分:0)
这可能适合你(GNU sed):
sed '/LOAD_FILE/aDELIMITER AS '\'\|\' file
这会在DELIMITER AS \'\|\'
LOAD_FILE
行
N.B。 sed命令分为两部分,/LOAD_FILE/aDELIMITER AS
与\'\|\'
如果您愿意:
sed 's/LOAD_FILE/&\nDELIMITER AS '\'\|\''/' file