The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to search file content satimis Linux 4 10-22-2008 01:46 AM
Search files with specfic extention and later search content lovi_v UNIX for Advanced & Expert Users 2 07-14-2008 01:05 PM
shell script to search content of file with timestamps in the directory psychobeauty Shell Programming and Scripting 10 04-21-2008 06:37 AM
grep/cat/more -- search in a txt file and display content from a specific "keyword" I-1 UNIX for Dummies Questions & Answers 4 02-21-2007 04:57 AM
How to search files containing a specific word in the content amjath78 UNIX for Dummies Questions & Answers 1 01-03-2007 03:42 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-04-2008
elenatec elenatec is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 5
Search File content.

Hi,
I have a problem when searching a file, the file containt with the following:

95671660:Jones:Sarah:45:sales manager
93272658:Smith:John:43:technical manager
98781987:Williams:Nick:35:computer officer
99893878:Brown:Sarah:12:electrician
95673456:Couchavid:26:chef
95437869:Anderson:Sarah:19:CEO

I need to take out every informaton within ":"

will become

Anderson Sarah 95437869 19 CEO
Brown Sarah 99893878 12 electrician
Couch David 95673456 26 chef
Jones Sarah 95671660 45 sales manager
Smith John 93272658 43 technical manager
Williams Nick 98781987 35 computer officer


phone number, Name, Sur Name, position, and other.
  #2 (permalink)  
Old 09-04-2008
dennis.jacob dennis.jacob is offline Forum Advisor  
dj - the student
  
 

Join Date: Feb 2007
Location: Singapore/Bangalore/Cochin
Posts: 597
Code:
awk -F":"  '{ print $2" "$3" "$1" "$4" "$5; }' filename | sort

Last edited by dennis.jacob; 09-04-2008 at 12:39 PM.. Reason: Added for sorting
  #3 (permalink)  
Old 09-04-2008
manosubsulo manosubsulo is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 87
cat File.txt
95671660:Jones:Sarah:45:sales manager
93272658:Smith:John:43:technical manager
98781987:Williams:Nick:35:computer officer
99893878:Brown:Sarah:12:electrician
95673456:Couchavid:26:chef
95437869:Anderson:Sarah:19:CEO

awk -F':' '{print $2,$3,$1,$4,$5}' File.txt | sort
  #4 (permalink)  
Old 09-04-2008
elenatec elenatec is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 5
wow thx it work greats.

i'm not fimilair with awk i try to understand more on it

many thx.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:12 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0