我正在尝试使用 plowshare 编写上传模块,但我在上传页面解析时遇到问题。
我需要提取upload_url
<script type="text/javascript">
upload_url: "http://s73.domain.com/?action=uploadfiles&user_id=TVRnN21ESX2c&secret_code=f4r6w35q639ih7oi62u674ae91453697", // Relative to the SWF file (or you can use absolute paths)
登录后,我加载页面进行上传,然后我需要提取upload_url
我尝试:
'upload_url:' '"\([[:digit:]]|http[:]//[^ ])*'
但我收到此错误
sed: -e expression #1, char 60: Unmatched ( or \(
答案 0 :(得分:1)
<强> sed的:强>
sed -nE 's/.*upload_url: "([^"]+).*/\1/p' filename
输出:
http://s73.domain.com/?action=uploadfiles&user_id=TVRnN21ESX2c&secret_code=f4r6w35q639ih7oi62u674ae91453697
<强>的grep:强>
grep -oP 'upload_url: "\K[^"]+' filename
<强> AWK:强>
awk -F "\"" '/upload_url/ {print $2}' filename