Programming :: Finding Common Entries In Fields Using Awk?

May 31, 2010

I want to extract all the common entries in the given 3 columns(fields) in the file using awk::can somebody tell me how it can be done in awk...the file is::

NC_000858.pttNC_000858.fnaNC_001403.rnt
NC_001362.pttNC_001436.fnaNC_001407.rnt
NC_001364.pttNC_001503.fnaNC_001488.rnt

[code]....

View 8 Replies


ADVERTISEMENT

Ubuntu :: Way Of Finding Common Strings Between Two Files?

Jul 7, 2011

I have two text files in the form:1 ItemA [value]2 ItemB [value]3 ItemC [value]Some of these items are common for both files, while others are missing from either one or the other.I want to compare the values for each common item in the two lists, but don't know how. I have a vague idea that probably grep might be useful, but I don't know how to use it for this purpose.So, to sum it up, what I would like to do is to take to text files containing lists and merge their common items into a third file in the form:

1 ItemA [value_from_list1] [value_from_list2]
2 ItemB [value_from_list1] [value_from_list2]
3 ItemC [value_from_list1] [value_from_list2]

[code]....

View 2 Replies View Related

Programming :: How To Remove Last Two Fields

Apr 27, 2010

I have a filename file-name-here-1.2.3-i486-2.tar I would like to know how to remove the last two fields leaving only: file-name-here-1.2.3

I can use:

x=file-name-here-1.2.3-i486-2.tar
echo ${a%-*}

to remove the last field (after -) but how do i remove the last two in one fell swoop?

View 2 Replies View Related

Programming :: Awk: Swap Fields Given A Condition?

Oct 8, 2010

I have a file records as follows:

Jane pepe@pepe.biz
john@pepe.net John
Joe joe@willxyz.org

How can I get that always first field be given name and second one be the mail address?

I've tried

Code:

awk '$1 ~ /@/ { a=$1 ; $1=$2; $2=a; print }' file

But that doesn't worked

View 5 Replies View Related

Programming :: Compare Files With Fields Separated With ':'?

Jul 16, 2011

Dear expertsI have files like

ABD : 5869 events, relative ratio : 1.173800E-01 , sum of ratios : 1.173800E-01
VBD : 12147 events, relative ratio : 2.429400E-01 , sum of ratios : 3.603200E-01
SDF : 17000 events, relative ratio : 3.400000E-01 , sum of ratios : 7.003200E-01

[code]....

View 3 Replies View Related

Programming :: Limit In Number Of Fields That Awk Can Handle

Mar 2, 2011

I have a file with 200 000 lines and I want to append the fields of each line based on matching first field. The resulting file should have 70 000 columns but has "only" 18 000. The command I'm using is working perfectly with a smaller file, wich lead to 14 000 columns. Could there be a limit in number of fields that awk can handle ? Here's my awk command :

Code:

awk -F, 'END { for (k in _) print _[k] } { _[$1] = $1 in _ ? _[$1] FS $4 : $1","$4 } ' file > out

Also, this command writes ^M (windows line break) after each columns. Removing them is easy but where do they come from ? Working on Ubuntu 10.10

View 4 Replies View Related

Programming :: Split Fields In A Perl Array?

Dec 16, 2010

I have an array called @logons. How can I step thru the array and split the fields? This is what I have so far, but doesnt work. I got the feeling I the split statement syntax is incorrect.

Code:

print @logons;
foreach my $logons(@logons){
($userid, $ip) = split(',',$logons);

[code]....

Update: Appears the data in @logons has a column header from the mysql query which I used to populate it with. So that code which I was testing does indeed work.

View 10 Replies View Related

Programming :: Bash - Generating A Table With Aligned Fields

Apr 9, 2009

I want to write a function which calculates the space needed between fields, to generate a table with aligned fields, like when you type "ls -l", the operating system generates a table with beautifully aligned fields. I've got this code so far:

Code:

for line in $(cat tmpSearch)
do
line=`echo $line | tr ":" " "`

[code]....

View 2 Replies View Related

Programming :: Show The Output Of These Fields In A Certain Way That Every Record Is Numbered?

Mar 25, 2010

i am reading a database flat file with the "awk" command which has 4 fields separated by colon ":" .I want to show the output of these fields in a certain way that every record is numbered e.g

1.some text
2.some text

Is there a way to do this?

View 14 Replies View Related

Programming :: While Receiving Can Use Functions Like Strchr() To Differentiate These Fields For Sockets?

Apr 15, 2009

constructing a protocol where in it involves sending and receiving different files, so sending data over consists of file name, size of the file and content of the file, so while receiving can i use functions like strchr() to differentiate these fields for sockets? so to allocate memory for file to save i need to have its size.

View 3 Replies View Related

Programming :: Updating A Sequence Of Datetimes In Fields With Unique Contrains

Mar 14, 2010

I am faced with the following problem; I need to update all fields of type datetime without ... with the following sort data:01-01-2010 12:10:30.256 - this is just an example.these fields are restricted with a unique constrained. My question is how can I generate the above sort data, especially the last three numbers with leading point. After that how can I update a table with existing data with this newly generated data so that the fields really do carry unique data.As you probably can read out of my question, I read through the help in pgAdmin and came as far as generating date, maybe datetime but not the .123 number. And a little insert script I found in the help, that I modified as UPDATE resulted in updating only the last generated data in all required fields.

View 7 Replies View Related

General :: Error: Php53-common Conflicts With Php-common

Jun 4, 2011

I have installed php 5.3.6-4 on centOS 5.6. When i try to install some modules of php then it gives an error

php53-common-5.3.3-1.el5_6.1.i386 from updates has depsolving problems
--> php53-common conflicts with php-common
Error: php53-common conflicts with php-common

[code]....

I have reinstall it twice but each time i get same error.

View 6 Replies View Related

Programming :: Include Common Elements On Every Page?

May 16, 2010

I am trying to learn how to include common elements on every page. At first I made the mistake of calling it ssi but I do not think that is correct in php5. I downloaded phpb3 to look at and they are not doing it that way. they do it like this.
Code...

Problem is I can not find any articles that explain it. I even looked at the php manual and did not find it. Could someone explain this or point me in the right direction.

View 1 Replies View Related

Programming :: GNU Common LISP Package Implementing Forkpty()?

Mar 21, 2011

I seek a GNU Common LISP package which implements forkpty(); openpty() would also be a big plus, and login_tty() would be a luxury I could live with.

View 3 Replies View Related

Programming :: Correct / Common Directory Tree For Software Packages?

Mar 16, 2011

I found it easiest to embed narp into the gtk+-2.0 installation because all I needed to do was tweak the Makefile.am and Makefile.in files and let configure do the rest.This is a hack. I've failed at getting my own makefiles to work.

Would anyone point me in the right direction on how to properly make an installer for Linux? Also, what is the correct/common directory tree for Linux software packages? Any more suggestions on proceeding with this project using community standards?

View 2 Replies View Related

Programming :: Formatting Fields And Text Being Displayed From Text File?

Feb 9, 2011

I want to display the contents of a particular log file (simple text file, I mean in Linux). But there is a problem: The contents need to be organized in a fixed format. Have a look at this log file:

sampleLog.txt

Code:

User Name: XYZ
Reported Problems Description: Blah! Blah! Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah!

[code]....

So, while displaying the contents of above file on a web page, I want to format the field names found in the log file: User Name:, Reported Problems Description:, and Remarks:. These fields may contain a variable length of text and no specific line number is assumed for them to appear on.

The desired output should look like this:

User Name: XYZ
Reported Problems Description: Blah! Blah! Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah!

[code]....

Well, what I am trying to do may sound wierd to some of you. The filed "Reported Problems Description:" can possible contain text which embeds colon (.

View 15 Replies View Related

Programming :: How To Track Entries In CVS

Nov 30, 2010

I have an inventory.txt file in CVS, which has about 5000 lines. First ten lines from inventory.txt are following:

Code:
Serial_Number Location
P303948932 Shelf:4F
F348237842 Shelf:2C
W312390232 Shelf:9L
Q239432042 Shelf:1E

[Code]...

View 1 Replies View Related

Programming :: Remove Duplicate Entries On A Row?

Nov 1, 2010

we have a variable LIBS:

LIBS='-lpq -lmysqlclient -lssl -lpthread -lresolv -lssl -lpthread -lresolv'

I'd want to get:

LIBS='-lpq -lmysqlclient -lssl -lpthread -lresolv'

Bear in mind that LIBS can be variable, I mean I need to drop any duplicate and only retain the last one of each different entry. And we must keep the order as is, I must not sort out them.

So, if LIBS is:

LIBS='-lpq -lmysqlclient -lpthread -lresolv -lpthread -lresolv'

I need: LIBS='-lpq -lmysqlclient -lpthread -lresolv'

View 3 Replies View Related

Debian Programming :: Add Entries To Existing Menu

Jan 12, 2014

What I would like to do is, with a right click, have the menu give me the option to run srm, which is a "secure remove" program. I picked this one as it requires not only a file name, but some other options. I've run into no support adding things to menus. When I updated one of the Debian versions, I lost the shutdown option from the name menu that used to be there. It was suggested that I right click and pick that option to restore it, but I get the same as the left button on that menu.

View 2 Replies View Related

Programming :: Getting Duplicate Entries In Mysql Database?

Apr 13, 2011

I'm getting duplicate entries in mysql database when submitting a new item from a form. I initially loaded the database via IMPORT function in phpMyAdmin. This is my input form:

<center>
<br />
<FONT SIZE="5" ><b>Add Item Template</b></FONT>
<br />

[code].....

However, I do need to return the input form in order to keep entering new items into the database.

View 8 Replies View Related

Programming :: Loop To Process Entries In A File?

Jul 9, 2010

I hade created a file with following text entries.

content of fileitems.txt
kdeaccessibility-4.4.92
kdeadmin-4.4.92
kdeartwork-4.4.92
kdebase-4.4.92

How do I read the file one line at a time and so its ready to do something with that line.

View 3 Replies View Related

Programming :: Remove Duplicate Entries From First Column?

May 12, 2010

I have a huge (over 10 gb) file with a list of IP's each followed by a corresponding number like this:

Code:

12.32.34.23 10
143.32.34.543 11
232.32.45.65 12
54.23.5.232 13
143.32.34.43 14
and so on..

I'm trying to sort this file numerically and weed out any duplicate IP addresses. How do I do this on bash? I have come up with this but obviously it does'nt work.

Code:

$sort -n myfile.txt | cut -f1 | uniq -u

View 2 Replies View Related

Programming :: Count Specific Entries Inside A Block?

Jul 15, 2011

What I want to do is from a file having block like

<event>
8 3 0.2685416E-02
2 -1 0
21 -1 0

[code]...

The first line after the "<event>" is its process-id, so I would like to have at the end a summary of how many "event" block I have for each type, ie how many

6 1 0.2685416E-02

or how many

7 2 0.2685416E-02

etc etc

I do not know in advance how many different-kind of block I will have, so it has to be a bit smart to scan the file, and make an new "summary" info for each unique type I was using something like

awk '/<event>/,/</event>/{if ($3 -eq 0.2685416E-02 ) { print $1" "$2" "$3}}' file > out

and then

grep -c "$1" "$2" "$3" but with no success since my awk commands prints all lines of each block

Suppose, that in advance I do know the $3, ie the 0.2685416E-02 which is a kind of weight

View 8 Replies View Related

General :: How To Add Entries / How To Delete Entries

Oct 13, 2010

I am working on Red Hat Linux since last six months and learning it steps by steps. like configurating ftp server,NSF ,DNS and then email server. I want to learn squid server but technically before going into it what you suggest me that may I first learn to configure Linux as a router,Firewall machine or do IP masquerading on a server. Because all these things are directly or indirectly involve in squid.So guide me because going to start squid i may understand Linux IP table ,how to add entries in it,how to delete entries ,I think you understand my point which i want to ask for guidence.

View 4 Replies View Related

Programming :: Finding Available Space In A Volume?

Nov 15, 2010

Given the name of a mounted volume (e.g., /mnt/vol), how would I determine its capacity and available space in C? I've been googling for a while now and nothing jumps out as the solution. I can use getmntent() to get the name of the actual partition that is associated with the mount point, e.g. /dev/sda2, but I can't figure out how to find the capacity of the volume nor how much space is remaining, such as what the df command shows. Is there an ioctl defined to get this information or some other system call?

View 1 Replies View Related

Programming :: Finding A Driver For ADE7758 ADC

Sep 29, 2010

I am interfacing ADE7758 to At91sam9261 spi interface. Linux 2.6.28 is running on my custom board. have driver for this 12-bit ADC (ADE7758) on linux ?

View 11 Replies View Related

Programming :: Finding Only String (Already There) In File

May 10, 2010

I have a file in which I have string called "already there" in some line of it. I want that if the string is present enter some loop..

like
if(( grep "already there" $file is true ))
then
--
--
fi

But the thing is when I make grep it gives the whole line in which this string is present and gives some error: if[ grep "already there" file ]: command not found. I am very new to shell scripting.

View 2 Replies View Related

Programming :: Finding The Day Of The Week In Different Timezones

Nov 10, 2010

I am using the following to find the Day of the Week on my server which is in UTC.

Code:

But say if I want to find the Day of the Week in another timezone, how would one go about it. I had a look at date --help but could not find any timezone related switches so am not sure if this is possible using this method.

Update:
This appears to work but is this the only way?

Code:

View 2 Replies View Related

Programming :: Mod_perl Not Finding Lperl?

Sep 10, 2010

I am trying to compile and install mod_perl with apache so I can use apache:asp.
I run Makefile.PL with this command.

Code:
perl Makefile.PL APACHE_SRC=../apache_2.2.9/src
DO_HTTPD=1 USE_APACI=1 EVERYTHING=1
APACI_ARGS='--prefix=/usr/local/httpd_perl'
then I run make.

I get this error.

[error]
/usr/bin/ld: cannot find -lperl
collect2: ld returned 1 exit status
make[1]: *** [mod_perl.so] Error 1
make[1]: Leaving directory `/usr/src/mod_perl/src/modules/perl'
make: *** [modperl_lib] Error 2
[/error]

It does not seem to be finding perl but I do nt know why or what to do about it?
could this be the problem? APACI_ARGS='--prefix=/usr/local/httpd_perl' I do not have the slightest ideal what that means or if I need it.

View 2 Replies View Related

Programming :: C - Finding About Function Naming Convention

Feb 13, 2010

What's most commonly used and what do you prefer? C-Style (this_is_my_function), Camelcase 1 (thisIsMyFunction), Camelcase 2 (ThisIsMyFunction

View 10 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved