scripting

Batch scripting find the first occurence of string taskid [duplicate]

南楼画角 提交于 2019-12-13 09:47:57
问题 This question already has answers here : How can I get unique records from in the below case (1 answer) How to get a particular value from file by batch script? [duplicate] (2 answers) Closed 11 days ago . I have a text file with a string occurs multiple lines. I want to get the line where this is the first occurrence of the string. I could find all occurrences using below command but I want only first occurrence in single line command. findstr /C:"taskId" Book.txt Book.txt 3047 [main] INFO

To extract specific pattern from file

家住魔仙堡 提交于 2019-12-13 09:28:13
问题 I am having below file file.txt where i need to extract pattern. CREATE TABLE `test`( `id` string COMMENT '', `age` string COMMENT '', `city` string COMMENT '') ROW FORMAT SERDE 'org.apache.hadoop.hive.ql.io.orc.OrcSerde' WITH SERDEPROPERTIES ( 'path'='hdfs://local/') STORED AS INPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat' OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat' LOCATION 'hdfs://local/' TBLPROPERTIES ( 'COLUMN_STATS_ACCURATE'='false', 'EXTERNAL'='FALSE'

awk : parse and write to another file

余生颓废 提交于 2019-12-13 09:16:20
问题 I have records in XML file like below. I need to search for <keyword>SEARCH</keyword> and if present then I need to take the entire record and write to another file.(starting from <record> to </record> ) Below is my awk code which is inside loop. $1 holds line by line value of each record. if(index($1,"SEARCH")>0) { print $1>> "output.txt" } This logic has two problems, It is writing to output.txt file, only <keyword>SEARCH</keyword> element and not the whole record(starting from <record> to

Parsing ls, not recommended

拟墨画扇 提交于 2019-12-13 08:59:40
问题 I received a advice for do not parse ls, like describes in this website: Don't parse ls. I was looking for DAILY files in my directory so that's what I did then: for f in *.DA*; do [[ -e $f ]] || continue for file in $f; do echo "The file that you are working on: "$file archiveContent=$( sed -n -e 1p $file ) echo $archiveContent done done Ok, that's works well, I've two files A.DAILY and B.DAILY, with the both archives I can get what is inside it, but when I changed a little bit the loop, it

Check the office License Status from batch file

时间秒杀一切 提交于 2019-12-13 08:59:32
问题 I am making a batch file that can check to see if your office 2013 has a icense or not. for /f "tokens=3 delims=: " %%a in ( 'cscript "%ProgramFiles%\Microsoft Office\Office15\OSPP.VBS" /dstatus ^| find "License Status:"' ) do set "licenseStatus=%%a" if /i "%licenseStatus%"=="--- LICENSED ---" ( Echo I am Licensed Pause EXIT ) Else ( Echo I am NOT Licensed Pause EXIT ) But every time I run this code it all way come back with a I am NOT Licensed. I have check it be running the ospp.vbs script

batch file that remembers what was copied [closed]

人盡茶涼 提交于 2019-12-13 08:45:21
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 3 years ago . This was the initial question which I need to be "extended" Creating folder from file, copy initial file into folder and add prefix This is the output batch for /f "tokens=*" %%A in ('dir /b *.mp4') do ( md "%%~nA" copy "%%~fA" "%%~nA\prefix_%%~nxA" ) (if there is a .mp4, create a folder with that

application/force-download

无人久伴 提交于 2019-12-13 08:39:24
问题 I'm creating a script to only upload zip files and I have the following validation allready: if($itemtype != "application/x-zip-compressed" && $itemtype != "application/zip" && $itemtype != "application/octet-stream") { throw new exception("Your file should be a zip file!"); } but I have a file with file type application/force-download but when I look in the mime types I can't find it, should I still add it in the validation (see code above)? the file I try to upload should be a normal zip

Does Powershell Core run on .NET Core?

杀马特。学长 韩版系。学妹 提交于 2019-12-13 08:27:08
问题 Title says it all. Wikipedia: Initially a Windows component only, known as Windows PowerShell, it was made open-source and cross-platform on 18 August 2016 with the introduction of PowerShell Core.[4] The former is built on .NET Framework while the latter on .NET Core . emphasis added. From what I recall reading, Powershell Core should be able to invoke, effectively, Mono . Is that correct? see also: Running PowerShell from .NET Core Running a PowerShell script in Mono? Do PowerShell scripts

How can I remove duplication of 2 separate which is interrelated with each other (PYTHON)

≯℡__Kan透↙ 提交于 2019-12-13 08:16:22
问题 After reading so many title, I couldn't solved the problem below. Does anyone can help me please ? For instance, I have 2 list (list_I and list_II) which is interrelated with each other. list_I = [123, 453, 444, 555, 123, 444] list_II = [A, A, B, C, A, B] What I hope to get is: New_list_I = [123, 453, 444, 555] New_list_II = [A , A, B, C] I use these two list as a body part of e-mail. That's why I need 2 separate (but on the other hand interrelated) list. I'm able to send an e-mail right now.

ActiveXObject FileSystemObject not releasing in Javascript

心不动则不痛 提交于 2019-12-13 08:14:46
问题 I have a Javascript function that saves JSON data locally, using an ActiveXObject in IE9. It links into FileSystemObject or FSO scripting for file access. If this Javascript function is run more than once, I get an error in IE debugger: "SCRIPT70: Permission denied" pointing to ts = savefile.OpenAsTextStream(2); Why will it run just fine the first time, but not after that? My best guess is that something's not being released properly, although I can find no information on MSDN (or here). Here