Script to pull hashes out of large text file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script to pull hashes out of large text file
# 1  
Old 04-23-2012
[solved] Script to pull hashes out of large text file

I am attempting to write a script that will pull out NTLM hashes from a text file that contains about 500,000 lines of data. Not all accounts contain hashes and I only need the ones that do contain hashes.

Here is a sample of what the data looks like:
Quote:
Mango Chango A (a):$NT$547e2494658ca345d3847c36cf1fsef8:::
There are thousands of other lines in the file, but that particular line is what I need taken out of the file. There are about 100 lines that apply to that and I do not want to manually go through the entire file searching for that.

Is there an easy script or something I can run in Linux to pull lines that follow that pattern out of the file?

Thank you!
# 2  
Old 04-23-2012
Not sure I understand

What is it about that line that meets your criteria for removal?
Also, probably helpful to see some 'good' lines, to make sure a rule does not touch those records inadvertently.
# 3  
Old 04-23-2012
I just want to pull out that data from the file. By "pull out" I do not mean cut from from the file, but just copy it and export it into a different file.

I need all the hashed from the txt file into a separate file. The line I provided is the 'good' line I need copied out into another file. There are about 100 additional lines with the same syntax as that one in the file that I need copied out.
# 4  
Old 04-23-2012
Then what is a bad line?

Is this bad?
Code:
#Mango Chango A (a):$NT$547e2494658ca345d3847c36cf1fsef8:::

# 5  
Old 04-23-2012
This worked:

Code:
awk -F: '($2 ~ /\$NT\$/)'filename

# 6  
Old 04-23-2012
It would have been very helpful, and that was the information joey was trying to get from you, what the identifier for the wanted lines is. So it is $NT$. That's all we needed to know Smilie Maybe next time.
# 7  
Old 04-23-2012
No need for the parentheses:
Code:
awk -F: '$2 ~ /\$NT\$/' infile

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

splitting a large text file into paragraphs

Hello all, newbie here. I've searched the forum and found many "how to split a text file" topics but none that are what I'm looking for. I have a large text file (~15 MB) in size. It contains a variable number of "paragraphs" (for lack of a better word) that are each of variable length. A... (3 Replies)
Discussion started by: lupin..the..3rd
3 Replies

2. Shell Programming and Scripting

Creating Hashes of Hashes of Array

Hi folks, I have a structure as mentioned below in a configuration file. <Component> Comp1: { item1:data,someUniqueAttribute; item2:data,someUniqueAttribute, } Comp2: { item3:data,someUniqueAttribute; ... (1 Reply)
Discussion started by: ckv84
1 Replies

3. Shell Programming and Scripting

Easy way to pull a paragraph from a text file?

I have a collection of text files that comprise a mailing list archive. I grep them to find an email that interests me, then open the file in a text editor to find the surrounding paragraph of text. Is there an easy way to do this from the shell instead? (2 Replies)
Discussion started by: CRGreathouse
2 Replies

4. Shell Programming and Scripting

Please do help: Perl Script to pull out rows from a CSV file

I have CSV file that contains data in the format as shown below: ABC, 67, 56, 67, 78, 89, 76, 55 PDR, 85, 83, 83, 72, 82, 89, 83 MPG, 86, 53, 54, 65, 23, 54, 75 .. .. .. .. I want to create a script that will pull out the rows from the above sheet and paste it into another CSV file.... (12 Replies)
Discussion started by: pankajusc
12 Replies

5. Shell Programming and Scripting

Need script to pull multiple field from log file

I am hoping to get some help with a script to pull certain fields from a log file. User update (xx6xxx P) rpt (yy6yyy B) 2010/01/20 21:36:01.298 Remote client forward start streamid 85af 2010/01/20 21:36:01.307 rpt2 (ZZ6ZZZ G) rpt1 (YY6YYY B) urcall (CQCQCQ ) mycall (W1AW) user... (5 Replies)
Discussion started by: TedSD
5 Replies

6. Shell Programming and Scripting

Help with splitting a large text file into smaller ones

Hi Everyone, I am using a centos 5.2 server as an sflow log collector on my network. Currently I am using inmons free sflowtool to collect the packets sent by my switches. I have a bash script running on an infinate loop to stop and start the log collection at set intervals - currently one... (2 Replies)
Discussion started by: lord_butler
2 Replies

7. Shell Programming and Scripting

Performance issue in UNIX while generating .dat file from large text file

Hello Gurus, We are facing some performance issue in UNIX. If someone had faced such kind of issue in past please provide your suggestions on this . Problem Definition: /Few of load processes of our Finance Application are facing issue in UNIX when they uses a shell script having below... (19 Replies)
Discussion started by: KRAMA
19 Replies

8. UNIX for Dummies Questions & Answers

Pull a file from a remote server through a shell script

Hi, I am writing a shell script to pull a file from a remote server (Let say its a windows based remote server). One of my criteria is to pull a file only if it is not empty. We have done a similar script to push a file from our end to a remote server and before pushing it we check for the... (2 Replies)
Discussion started by: sashankkrk
2 Replies

9. Shell Programming and Scripting

Can a shell script pull the first word (or nth word) off each line of a text file?

Greetings. I am struggling with a shell script to make my life simpler, with a number of practical ways in which it could be used. I want to take a standard text file, and pull the 'n'th word from each line such as the first word from a text file. I'm struggling to see how each line can be... (5 Replies)
Discussion started by: tricky
5 Replies
Login or Register to Ask a Question