LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-03-2014, 09:08 AM   #1
sedna06
LQ Newbie
 
Registered: Jul 2012
Posts: 23

Rep: Reputation: Disabled
Clean Up file in Bash


Hello Guys,

I have a file with the following located in there

/home/adversion/web/wp-content/plugins/akismet/index1.php: PHP.Mailer-7 FOUND
/home/beckydodman/web/oldshop/images/google68274020601e.php: Trojan.PHP-1 FOUND
/home/resurgence/web/Issue 272/Batch 2 for Helen/keynote_Philip Baldwin (author revise).doc: W97M.Thus.A FOUND
/home/resurgence/web/Issue 272/from Helen/M keynote_Philip Baldwin.doc: W97M.Thus.A FOUND
/home/skda/web/clients/sandbox/wp-content/themes/editorial/cache/external_dc8e1cb5bf0392f054e59734fa15469b.php: Trojan.PHP-58 FOUND

what I need is to be able to clean this file up by removing everything after the :

so that it looks like this.

/home/adversion/web/wp-content/plugins/akismet/index1.php
/home/beckydodman/web/oldshop/images/google68274020601e.php
/home/resurgence/web/Issue 272/Batch 2 for Helen/keynote_Philip Baldwin (author revise).doc
/home/resurgence/web/Issue 272/from Helen/M keynote_Philip Baldwin.doc
/home/skda/web/clients/sandbox/wp-content/themes/editorial/cache/external_dc8e1cb5bf0392f054e59734fa15469b.php

any help would be appreciated
 
Old 03-03-2014, 09:24 AM   #2
replica9000
Senior Member
 
Registered: Jul 2006
Distribution: Debian Unstable
Posts: 1,126
Blog Entries: 2

Rep: Reputation: 260Reputation: 260Reputation: 260
Code:
cat file | awk -F ":" '{print $1}' > newfile
 
Old 03-03-2014, 10:20 AM   #3
sedna06
LQ Newbie
 
Registered: Jul 2012
Posts: 23

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by replica9000 View Post
Code:
cat file | awk -F ":" '{print $1}' > newfile
Thanks Replica9000
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to launch clean bash session locus84 Linux - Newbie 2 04-25-2011 02:21 PM
LXer: Use the Bash trap Statement to Clean Up Temporary Files LXer Syndicated Linux News 0 05-06-2009 01:00 AM
Need script to clean up file stevemcb Programming 26 01-18-2008 05:55 AM
Clean log bash script? QuarQuar Linux - General 4 10-27-2007 11:46 PM
How i can Clean up the log file of proxy? AZIMBD03 Red Hat 4 10-10-2003 08:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration