Sponsored Content
Top Forums Shell Programming and Scripting Add similar pairs in a txt file Post 302777073 by ctsgnb on Thursday 7th of March 2013 10:25:23 AM
Old 03-07-2013
Code:
# cat foot
  ASP - GLN = 14
  SER - GLU = 14
  ARG - ASN = 13
  ARG - TYR = 13
  ASP - ARG = 13
  GLU - ARG = 13
  GLU - GLN = 13
  ALA - ARG = 12
  ARG - GLN = 12
  ASN - ARG = 12
  ASN - ASP = 12
# awk '{i=($3<$1?$3" - "$1:$1" - "$3);A[i]+=$5}END{for(i in A) print i" = " A[i]}' foot
ARG - TYR = 13
ARG - ASP = 13
ARG - GLU = 13
GLU - SER = 14
ALA - ARG = 12
ARG - GLN = 12
ASP - GLN = 14
ASN - ASP = 12
GLN - GLU = 13
ARG - ASN = 25
#

These 2 Users Gave Thanks to ctsgnb For This Post:
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to create file.txt and add current date in file content

Hey guy, how to make bash script to create foo.txt file and add current date into file content and that file always append. example: today the script run and add today date into content foo.txt and tomorrow the script will run and add tomorrow date in content foo.txt without remove today... (3 Replies)
Discussion started by: chenboly
3 Replies

2. Shell Programming and Scripting

Generate a mail when you add info to a txt file

Hi, I have an application's log file: /var/log/logfile which is feeded from time to time due to an application. This file contains data, what I want is: -Whenever some new data is copied to /var/log/logfileI want to generate an email to root BUT only with the new added data in the body.... (6 Replies)
Discussion started by: iga3725
6 Replies

3. Shell Programming and Scripting

Find similar entry in a .txt file acting as a database.

May i know how do i go along finding similar entry in a .txt file, which is used a as a "database" and post and error saying the entry existed when we key in the entry. ---------- Post updated at 05:18 PM ---------- Previous update was at 05:16 PM ---------- i mean post an error saying the... (5 Replies)
Discussion started by: santonio
5 Replies

4. Shell Programming and Scripting

how to add extra a field in a flat txt file ?

Hi all, I did not use UNIX for a long time, now i need to make a flat file with extra field, can you help me with the code ? 1. I create a last line of each log from each system and make it in a flat text file (seperate by a pipe |) mv current.log old tail -1 sanfrancisco.log > current.log... (5 Replies)
Discussion started by: britney
5 Replies

5. UNIX for Dummies Questions & Answers

Add a new column to txt file containing filename

I would like help adding a new column to a large txt file (~10MB) that contains the filename. I have searched other posts but have not found an adequate solution. I need this extra column so I can concatenate >100 files and perform awk searches on this large file. My current txt file look... (4 Replies)
Discussion started by: kellywilliams
4 Replies

6. Shell Programming and Scripting

create txt file form data file and add some line on it

Hi Guys, I have file A.txt File A Data AK1521 AK2536 AK3164 I want create text file of all data above and write some data on each file. want Output on below folder /home/kka/out AK1521.txt Hi Welocme (3 Replies)
Discussion started by: asavaliya
3 Replies

7. UNIX for Dummies Questions & Answers

How to add a header to a tab delimited .txt file?

Hi, I have a tab delimited document with 18 columns. My file looks like: comp1000201_c0_seq1 comp1000201_c0 337 183.51 0.00 0.00 0.00 0.00 ---NA--- 337 0 0 - comp1000297_c0_seq1 comp1000297_c0 612 458.50 ... (1 Reply)
Discussion started by: alisrpp
1 Replies

8. Windows & DOS: Issues & Discussions

2 Questions: replace text in txt file, add text to end of txt file

so... Lets assume I have a text file. The text file contains multiple "#" symbols. I want to replace all thos "#"s with a STRING using DOS/Batch I want to add a certain TEXT to the end of each line. How can I do this WITHOUT aid of sed, grep or anything linux related ? (1 Reply)
Discussion started by: pasc
1 Replies

9. UNIX for Beginners Questions & Answers

How can i add each line from a txt file to different files in the same directory?

Hello, this is my first thread here :) So i have a text file that contains words in each line like abcd efgh ijkl mnop and i have 4 txt files, i want to add each line to each file, like file 1 gets abcd at the end; file 2 gets efgh at the end .... I tried with: cat test | while read -r... (6 Replies)
Discussion started by: azaiiez
6 Replies
XML::Easy::Classify(3pm)				User Contributed Perl Documentation				  XML::Easy::Classify(3pm)

NAME
XML::Easy::Classify - classification of XML-related items SYNOPSIS
use XML::Easy::Classify qw( is_xml_name check_xml_name is_xml_encname check_xml_encname is_xml_chardata check_xml_chardata is_xml_attributes check_xml_attributes is_xml_content_object check_xml_content_object is_xml_content_twine check_xml_content_twine is_xml_content check_xml_content is_xml_element check_xml_element ); if(is_xml_name($arg)) { ... check_xml_name($arg); if(is_xml_encname($arg)) { ... check_xml_encname($arg); if(is_xml_chardata($arg)) { ... check_xml_chardata($arg); if(is_xml_attributes($arg)) { ... check_xml_attributes($arg); if(is_xml_content_object($arg)) { ... check_xml_content_object($arg); if(is_xml_content_twine($arg)) { ... check_xml_content_twine($arg); if(is_xml_content($arg)) { ... check_xml_content($arg); if(is_xml_element($arg)) { ... check_xml_element($arg); DESCRIPTION
This module provides various type-testing functions, relating to data types used in the XML::Easy ensemble. These are mainly intended to be used to enforce validity of data being processed by XML-related functions. There are two flavours of function in this module. Functions of the first flavour only provide type classification, to allow code to discriminate between argument types. Functions of the second flavour package up the most common type of type discrimination: checking that an argument is of an expected type. The functions come in matched pairs. FUNCTIONS
Each of these functions takes one scalar argument (ARG) to be tested. Any scalar value is acceptable for the argument to be tested. Each "is_" function returns a simple truth value result, which is true iff ARG is of the type being checked for. Each "check_" function will return normally if the argument is of the type being checked for, or will "die" if it is not. is_xml_name(ARG) check_xml_name(ARG) Check whether ARG is a plain string satisfying the XML name syntax. (Such names are used to identify element types, attributes, entities, and other things in XML.) is_xml_encname(ARG) check_xml_encname(ARG) Check whether ARG is a plain string satisfying the XML character encoding name syntax. is_xml_chardata(ARG) check_xml_chardata(ARG) Check whether ARG is a plain string consisting of a sequence of characters that are acceptable to XML. Such a string is valid as data in an XML element (where it may be intermingled with subelements) or as the value of an element attribute. is_xml_attributes(ARG) check_xml_attributes(ARG) Check whether ARG is a reference to a hash that is well-formed as an XML element attribute set. To be well-formed, each key in the hash must be an XML name string, and each value must be an XML character data string. is_xml_content_object(ARG) check_xml_content_object(ARG) Check whether ARG is a reference to an XML::Easy::Content object, and thus represents a chunk of XML content. is_xml_content_twine(ARG) check_xml_content_twine(ARG) Check whether ARG is a reference to a twine array (see "Twine" in XML::Easy::NodeBasics), and thus represents a chunk of XML content. is_xml_content_array(ARG) Deprecated alias for "is_xml_content_twine". is_xml_content(ARG) check_xml_content(ARG) Check whether ARG is a reference to either an XML::Easy::Content object or a twine array (see "Twine" in XML::Easy::NodeBasics), and thus represents a chunk of XML content. is_xml_element(ARG) check_xml_element(ARG) Check whether ARG is a reference to an XML::Easy::Element object, and thus represents an XML element. SEE ALSO
Params::Classify, XML::Easy::NodeBasics AUTHOR
Andrew Main (Zefram) <zefram@fysh.org> COPYRIGHT
Copyright (C) 2009, 2010, 2011 Andrew Main (Zefram) <zefram@fysh.org> LICENSE
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2011-11-16 XML::Easy::Classify(3pm)
All times are GMT -4. The time now is 01:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy