07-06-2010
Modifying data within the same line
My file looks like this
Quote:
;1.0
26;27;30;39;45;46;47;48;51;54;55;56;57;58;59;60;61;62;63;64;65;66;68;69;71;72;73;74;76;77;78;80;82;8 3;84;85;86;87;88;89;90;91;93;94;95;96;97;98;99;102;103;104;105;106;107;108;109;110;114;115;116;119;1 20;121;124;133;136;141;145;147;150;151;157;
10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;1 0;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10 ;10;10;10;10;10;10;
>GHXCZCC01AJ9EA Freq 59;1;;;;
GTCTGGACCCGGGGCGAGGCTGTCGCGCCGGTTTCATGCCCGCGTCTCCCACCGTGCGGCTGCAGGTTATAAA
>GHXCZCC01ANKKF Freq 33;1;;;;
GTCTGGACCCGGGGCGAGGCTGTCGCGCCGGTTTCATGCCCGCGTCTCCCACCGTGCGGCTGCAGGTTATAGA
>GHXCZCC01AQARH Freq 22;1;;;;
GTCTGGACCCGGGGTGAGGCTGTCGCGCCGGTTCCCTGCCCGCGTCTCCCACCATGCGGCTGCAGGTTATAGA
>GHXCZCC01AL97H Freq 21;1;;;;
GTCTGGACCCGGGGTGAGGCTGTCGCGCCGGTTTCATGCCCGCGTCTCCCACCGTGCGGCTCCAGGTTATAGA
>GHXCZCC01AO1HG Freq 313;1;;;;
GTCTGGACCCGGGGCGAGGCTGTCGCGCCGGTTCCCTGCCCGCGTCTCCCACCATGCGGCTGCAGGTTATAGA
But I need to move the frequency value (Freq) to the second position, leaving intact the numbers at the top. The resulting file should look like this
Quote:
;1.0
26;27;30;39;45;46;47;48;51;54;55;56;57;58;59;60;61;62;63;64;65;66;68;69;71;72;73;74;76;77;78;80;82;8 3;84;85;86;87;88;89;90;91;93;94;95;96;97;98;99;102;103;104;105;106;107;108;109;110;114;115;116;119;1 20;121;124;133;136;141;145;147;150;151;157;
10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;1 0;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10 ;10;10;10;10;10;10;
>GHXCZCC01AJ9EA ;59;;;;
GTCTGGACCCGGGGCGAGGCTGTCGCGCCGGTTTCATGCCCGCGTCTCCCACCGTGCGGCTGCAGGTTATAAA
>GHXCZCC01ANKKF ;33;;;;
GTCTGGACCCGGGGCGAGGCTGTCGCGCCGGTTTCATGCCCGCGTCTCCCACCGTGCGGCTGCAGGTTATAGA
>GHXCZCC01AQARH ;22;;;;
GTCTGGACCCGGGGTGAGGCTGTCGCGCCGGTTCCCTGCCCGCGTCTCCCACCATGCGGCTGCAGGTTATAGA
>GHXCZCC01AL97H ;21;;;;
GTCTGGACCCGGGGTGAGGCTGTCGCGCCGGTTTCATGCCCGCGTCTCCCACCGTGCGGCTCCAGGTTATAGA
>GHXCZCC01AO1HG ;313;;;;
GTCTGGACCCGGGGCGAGGCTGTCGCGCCGGTTCCCTGCCCGCGTCTCCCACCATGCGGCTGCAGGTTATAGA
Thanks in advance!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi there
How can I compare data line by line from a file?
I need to compare the second value with the fourth to know if they are different.
If those values are different, I require to send my first value to the output until the complete file has been read.
This is my file:
0 FALSE... (1 Reply)
Discussion started by: loperam
1 Replies
2. Shell Programming and Scripting
I have my data something like this
SERIAL FIRSTOCCURRENCE
NETPROTOCOL
1947430693 07/01/2009 05:16:40
FR
SERIAL FIRSTOCCURRENCE
NETPROTOCOL
1947430746 07/01/2009 05:18:05
FR
I want the output as follows.... (1 Reply)
Discussion started by: rdhanek
1 Replies
3. Shell Programming and Scripting
Hi,
I am having trouble modifying this line. It is because there is a space that I dont know how to deal with.
So the file looks like this
>YM4911-Contig4
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
>YM4915-Contig5
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
There are two spaces between contig#... (6 Replies)
Discussion started by: phil_heath
6 Replies
4. Shell Programming and Scripting
Hi,
I want to print specific columns (from 201 to 1001). The line that I am using is listed below. However I also want to print column 1. So column 1 and 201 to 1001. What modifcations do I need to make?
Code:
awk -F'\t' 'BEGIN {min = 201; max = 1001 }{for (i=min; i<=max; i++) printf... (5 Replies)
Discussion started by: phil_heath
5 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I have a file containing data:
systemname/userid/password/comment
systemname1/userid1/password1/comment1
systemname2/userid2/password2/comment2
I want to modify the "password" using script.
Can anybody help me with this problem?:confused: (2 Replies)
Discussion started by: pgarg1989
2 Replies
6. Shell Programming and Scripting
Hi Forum.
Is there a quick way to do the following search/replace within a block of data? I tried to google the solution but didn't really know what to look for.
I have the following text file (I want to search for a particular string "s_m_f_acct_txn_daily_a1" and replace the... (5 Replies)
Discussion started by: pchang
5 Replies
7. Shell Programming and Scripting
Hi.. I'm into a bump after trying to solve this prob.. i've a file with contents like below.
<blankline>
'pgmId' : 'UNIX',
'pgmData' : 'textfile',
'author' : 'admin',
.......
Now i'm trying to insert a new data after pgmId. so the final output will be... (7 Replies)
Discussion started by: arjun_arippa
7 Replies
8. Shell Programming and Scripting
Hi all,
I am having a slight issue updating a file using perl from the command line I need some help with.
The item is:
DATA_FILE_TYPE=FULL
When I run the below command
/usr/bin/perl -p -i -e "s/DATA_FILE_TYPE=/DATA_FILE_TYPE=APPEND/g" processfile.cfg
It looks to be... (2 Replies)
Discussion started by: kstevens67
2 Replies
9. Shell Programming and Scripting
I need to modify a bash script to to take each line in a file and execute command. I currently have this:
#!/bin/bash if ; then echo "Lipsa IP"; exit; fi i=1 ip=$1 while ; do if ; then rand=`head -$i pass_file | tail -1` user=`echo $rand | awk '{print $1}'` pass=`echo $rand | awk '{print $2}'`... (3 Replies)
Discussion started by: galford
3 Replies
10. Shell Programming and Scripting
Hello,
I have some text data that is in the form of multi-line records. Each record ends with the string $$$$ and the next record starts on the next line.
RDKit 2D
15 14 0 0 0 0 0 0 0 0999 V2000
5.4596 2.1267 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 ... (5 Replies)
Discussion started by: LMHmedchem
5 Replies
ISALPHA(3) BSD Library Functions Manual ISALPHA(3)
NAME
isalpha -- alphabetic character test
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <ctype.h>
int
isalpha(int c);
DESCRIPTION
The isalpha() function tests for any character for which isupper(3) or islower(3) is true. The value of the argument must be representable
as an unsigned char or the value of EOF.
In the ASCII character set, this includes the following characters (preceded by their numeric values, in octal):
101 ``A'' 102 ``B'' 103 ``C'' 104 ``D'' 105 ``E''
106 ``F'' 107 ``G'' 110 ``H'' 111 ``I'' 112 ``J''
113 ``K'' 114 ``L'' 115 ``M'' 116 ``N'' 117 ``O''
120 ``P'' 121 ``Q'' 122 ``R'' 123 ``S'' 124 ``T''
125 ``U'' 126 ``V'' 127 ``W'' 130 ``X'' 131 ``Y''
132 ``Z'' 141 ``a'' 142 ``b'' 143 ``c'' 144 ``d''
145 ``e'' 146 ``f'' 147 ``g'' 150 ``h'' 151 ``i''
152 ``j'' 153 ``k'' 154 ``l'' 155 ``m'' 156 ``n''
157 ``o'' 160 ``p'' 161 ``q'' 162 ``r'' 163 ``s''
164 ``t'' 165 ``u'' 166 ``v'' 167 ``w'' 170 ``x''
171 ``y'' 172 ``z''
RETURN VALUES
The isalpha() function returns zero if the character tests false and returns non-zero if the character tests true.
COMPATIBILITY
The 4.4BSD extension of accepting arguments outside of the range of the unsigned char type in locales with large character sets is considered
obsolete and may not be supported in future releases. The iswalpha() function should be used instead.
SEE ALSO
ctype(3), isalnum_l(3), islower(3), isupper(3), iswalpha(3), ascii(7)
STANDARDS
The isalpha() function conforms to ISO/IEC 9899:1990 (``ISO C90'').
BSD
July 17, 2005 BSD