473,385 Members | 1,610 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Extract specified columns from big file - with cat or perl/python script

4
I have a BIG text file (+700 mega) with data line,like

"id1","username1","password1","FIRSTNAME1","email1 ","subscriber1","date1",etc
"id2","username2","password2","FIRSTNAME2","email2 ","subscriber2","date2",etc

and i want to extract specified columns -FIRSTNAME- from each lines + I dont want , or " in results, the results must be in comuns

How i can do it? Thanks for help
Mar 6 '13 #1
4 1833
sicarie
4,677 Expert Mod 4TB
If you know how the file is set up, and you know that there will always be "" around the entries (if there are 'blanks' they'll appear as "") then you should be able to use awk to pull the columns you want and put them where you wanted.
Mar 11 '13 #2
erapop
4
yes, all columns are separated with " " - please help me with the exactly awk command, thanks
Mar 11 '13 #3
sicarie
4,677 Expert Mod 4TB
The awk users guide is here, you would need to specify the exact columns you wanted, and where you wanted them to go.
Mar 11 '13 #4
rski
700 Expert 512MB
try this
Expand|Select|Wrap|Line Numbers
  1. cat <your filename> | cut -d"," -f 4 | sed 's/"//g'
  2.  
Mar 13 '13 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

42
by: Fred Ma | last post by:
Hello, This is not a troll posting, and I've refrained from asking because I've seen similar threads get all nitter-nattery. But I really want to make a decision on how best to invest my time....
3
by: SeeBelow | last post by:
I have not been able to find a simple way to have a python script execute an MS-DOS program repeatedly. execv(), for example, won't run it more than once. I have been using many lines of a .bat...
4
by: Xah Lee | last post by:
# -*- coding: utf-8 -*- # Python # to open a file and write to file # do f=open('xfile.txt','w') # this creates a file "object" and name it f. # the second argument of open can be
1
by: Xah Lee | last post by:
suppose you want to do find & replace of string of all files in a directory. here's the code: ©# -*- coding: utf-8 -*- ©# Python © ©import os,sys © ©mydir= '/Users/t/web'
41
by: Xah Lee | last post by:
here's another interesting algorithmic exercise, again from part of a larger program in the previous series. Here's the original Perl documentation: =pod merge($pairings) takes a list of...
3
by: Pankaj | last post by:
I am facing a very basic problem as any new bie would face. I know perl and now i want to use python In perl, it is very simple , just "perl scriptname.pl" will execute the script. But i...
6
by: tatamata | last post by:
Hello. How can I run some Python script within C# program? Thanks, Zlatko
2
by: Viewer T. | last post by:
I am trying to write a script that deletes certain files based on certain criteria. What I am trying to do is to automate the process of deleting certain malware files that disguise themselves...
3
by: n o s p a m p l e a s e | last post by:
Suppose I have a batch file called mybatch.bat and I want to run it from a python script. How can I call this batch file in python script? Thanx/NSP
13
by: Alligatorr | last post by:
First, I'm completely new to using python, but willing to learn. I have very little programming skills, but again, I'm willing to learn. Second, I have a script (given to me) that receives data...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.