Help me grab a passage out of this text file?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help me grab a passage out of this text file?
# 1  
Old 12-20-2011
Help me grab a passage out of this text file?

Hey guys, I need a command that grabs only this part of the .txt file (that is attached), and outputs it to another .txt file with only these contents below. Thanks in advanced brothers:

Code:
Disk: Local Disk (C:), NTFS


Disk Defragmentation Summary

 

Disk Size 230.85 GB
Free Space Size 189.82 GB
Clusters 60514815
Sectors per cluster 8
Bytes per sector 512
Started defragmentation at 12/13/2011 1:22:16 PM
Completed defragmentation at 12/13/2011 1:23:00 PM
Elapsed time 00:00:43
Total Files 78490
Total Directories 19205
Fragmented Files 274
Defragmented Files 274
Skipped Files 0
Fragmentation Before 0.82% |
Fragmentation After 0.00%


Last edited by Scott; 12-20-2011 at 04:03 PM.. Reason: Code tags
# 2  
Old 12-20-2011
Code:
$ awk '/Defragmentation Summary/; /^Disk Size/ { P=1 } P; /^Fragmentation After/ { exit }' < fragsummary
Disk Defragmentation Summary
Disk Size 230.85 GB
Free Space Size 189.82 GB
Clusters 60514815
Sectors per cluster 8
Bytes per sector 512
Started defragmentation at 12/13/2011 1:22:16 PM
Completed defragmentation at 12/13/2011 1:23:00 PM
Elapsed time 00:00:43
Total Files 78490
Total Directories 19205
Fragmented Files 274
Defragmented Files 274
Skipped Files 0
Fragmentation Before 0.82% |
Fragmentation After 0.00%
$

# 3  
Old 12-20-2011
Sorry for being such a scripty kiddie noob. But I'll be deploying this on a windows machine and, I don't know where to specify the source c:\defraglog.txt in your command? I'll be uploading awk.exe or any other linux utilities that are made for windows to the target machine.. so it should work.
# 4  
Old 12-20-2011
replace 'fragsummary' with c:\whatever.txt
# 5  
Old 12-20-2011
THANKS BROTHA!!!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Grab text after pattern on the same line

data: 8iW5iPACIb5fafafEU24f3EOOjpakx6VwxBX+NafafxJMWX8iW5iPACIb5fafafEU24f3EOOjpakx6VwxBX+NafafxJMWX8iW5i PACIb5fafafEU24f3EOOjpakx6VwxBX+NafafxJMWX8iW5iPACIb5fafafEU24f3EOOjpakx6VwxBX+ 8nwR15UzfeZafaf2bGr8akx6VwxBX+NafafxJMWX8iW5iPACIb5fafafEU24f3EOOjp lVpOoMLXJ ... (19 Replies)
Discussion started by: SkySmart
19 Replies

2. Shell Programming and Scripting

awk remove/grab lines from file with pattern from other file

Sorry for the weird title but i have the following problem. We have several files which have between 10000 and about 500000 lines in them. From these files we want to remove lines which contain a pattern which is located in another file (around 20000 lines, all EAN codes). We also want to get... (28 Replies)
Discussion started by: SDohmen
28 Replies

3. Shell Programming and Scripting

Grab text after pattern and replace

i have a file which contains data seperated by comma. i want to replace text after 3rd occurrence of a comma. the input file looks like this abcdef,11/02/2015 11:55:47,1001,1234567812345678,12364,,abc abcdefg,11/02/2015 11:55:47,01,1234567812345678,123,,abc abcdefhih,11/02/2015... (4 Replies)
Discussion started by: gpk_newbie
4 Replies

4. Shell Programming and Scripting

Grab from file with sed

Hello All I have a file with this type of records: =LDR 01157nas a22003011a 4500 =001 vtls000000013 =003 VRT =005 20111020150800.0 =008 100128c19699999sp\a|||||\||||0\\\||spa| =037 \\$a1327$i090$j090$k03 =039 ... (14 Replies)
Discussion started by: ldiaz2106
14 Replies

5. Shell Programming and Scripting

Grab 2 pieces of data within a file

I am a newbie and what I have is a captured file of content. I want to be able to grab 2 pieces of data, multiple times and print them to the screen. DataFile owner: locke user: fun data size: 60 location: Anaheim owner: david user: work data size: 80 location: Orange my script... (2 Replies)
Discussion started by: greglocke
2 Replies

6. UNIX for Dummies Questions & Answers

Grab Portion of Output Text (sed, grep, awk?)

Alright, here's the deal. I'm running the following ruby script (output follows): >> /Users/name/bin/acweather.rb -z 54321 -o /Users/name/bin -c Clouds AND Sun 57/33 - Mostly sunny and cool I want to just grab the "57/33" portion, but that's it. I don't want any other portion of the line. I... (5 Replies)
Discussion started by: compulsiveguile
5 Replies

7. Shell Programming and Scripting

Grab from the file in one command

Dear All, I have a file in which there are 54 fields, i want to grab the all the lines and send to a new file where filed18 has lenght greater than 14. How can i do it without if condition and faster way: currently i am reading file line by line and comparing the length read fileLine... (9 Replies)
Discussion started by: bilalghazi
9 Replies

8. Shell Programming and Scripting

Extracting a Number from Passage

( Database Connection Information Database server = DB2/AIX6000 8.1 SQL authorization ID = LAKNAR Local database alias = SAMPLE ROWSAFFECTED ------------ 1 1 record(s) selected. DB20000I The SQL command completed successfully. DB20000I The TERMINATE... (1 Reply)
Discussion started by: laknar
1 Replies

9. Shell Programming and Scripting

find 2 line numbers, grab text in between

hi, i have a large text file that I just want to extract the important information from. It will be a random number of lines but between two specific line numbers/markers. I was thinking I could get the line number for the first marker: Tablespace Percent Total Free Then get the line... (11 Replies)
Discussion started by: Da_Duck
11 Replies

10. UNIX for Dummies Questions & Answers

How to Grab the latest file

I have been trying to use the find command to grab the latest file in a directory and move it to another area. I can't seem to get only that file, I end up getting everything for the day. Any ideas? Thank you (1 Reply)
Discussion started by: n9ninchd
1 Replies
Login or Register to Ask a Question