![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Removing parts of a specific field | kieranh | Shell Programming and Scripting | 9 | 09-28-2007 01:52 PM |
| removing parts of a line with SED | gammaman | UNIX for Dummies Questions & Answers | 2 | 08-05-2005 04:44 AM |
| filter parts of a big file using awk or sed script | apalex | Shell Programming and Scripting | 1 | 07-25-2005 05:45 PM |
| hiding parts of processes | dangral | UNIX for Dummies Questions & Answers | 2 | 05-29-2003 07:57 PM |
| cksum parts of a file | crazykelso | UNIX for Dummies Questions & Answers | 6 | 07-30-2002 12:38 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
getting parts of a file
Hello, I'm trying to retreive certain bits of info from a file.
the file contains a list like this info1:info2:info3:info4 info1:info2:info3:info4 info1:info2:info3:info4 info1:info2:info3:info4 how do i pick out only info2 or only info3 without the others? Thanks |
|
||||
|
I just want to make sure i understand these correct. Does it take the first line and process it, then go back to the beginning and process line two and then go back and so on and so on? Or does it do it for all the lines at the same time?
|
|
||||
|
Quote:
Code:
for lines in open("input.txt"):
lines = lines.strip().split(":")
print "Info 2 , second column: " , lines[1]
print "Info 3 , third column: " , lines[2]
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|