Sponsored Content
Top Forums Shell Programming and Scripting Replace a field with a character as per the field length Post 302764741 by Chubler_XL on Thursday 31st of January 2013 10:00:25 PM
Old 01-31-2013
Example to replace fields 2, 3 and 19 with '*' to field length (subsitute with the field#s you want to replace).

Code:
awk 'BEGIN{split("2,3,19", F, ",")} {for(fld in F) gsub(/./, "*", $fld)}1' filename

This User Gave Thanks to Chubler_XL For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Validating fixed length field...

What's wrong with this part of my script? I just want to put each column from a fixed length file into a variable so I can validate each field later in the script. exec< myfile.dat while read afile; do a=`echo $(echo $afile |cut -c1-10)` echo "$a" b=`echo $(echo $afile |cut -c11-20)`... (12 Replies)
Discussion started by: giannicello
12 Replies

2. Shell Programming and Scripting

Help with finding length of a field

I have a pipe delimited file. I need to check that the first and second fields are 5 characters long and if not i need to append 0 in front of them to make them 5 characters long. can some body let mwe know how i can find the length of the two fields and then make them 5 characters long if they... (6 Replies)
Discussion started by: dsravan
6 Replies

3. Shell Programming and Scripting

Count number of occurences of a character in a field defined by the character in another field

Hello, I have a text file with n lines in the following format (9 column fields): Example: contig00012 149606 G C 49 68 60 18 c$cccccacccccccccc^c I need to count the number of lower-case and upper-case occurences in column 9, respectively, of the... (3 Replies)
Discussion started by: s052866
3 Replies

4. Shell Programming and Scripting

Finding the length of a string in a field

I have a field MPN-BANK-NUMBERO:006,00:N in a file FILE1 How can i display the length of the Bank Number.Any idea ? The output shud take the following format FILE 1 6 Where 1 is the starting position and 6 is the Ending position. (9 Replies)
Discussion started by: bobby1015
9 Replies

5. Shell Programming and Scripting

Flat file-make field length equal to header length

Hello Everyone, I am stuck with one issue while working on abstract flat file which i have to use as input and load data to table. Input Data- ------ ------------------------ ---- ----------------- WFI001 Xxxxxx Control Work Item A Number of Records ------ ------------------------... (5 Replies)
Discussion started by: sonali.s.more
5 Replies

6. Shell Programming and Scripting

sed to replace a field from a line with another field

i have something like this, cat filename.txt hui this si s"dfgdfg" omeone ipaddress="10.19.123.104" wel hope this works i want to replace only 10.19.123.104 with different ip say 10.19.123.103 i tried this sed -i "s/'ipaddress'/'ipaddress=10.19.123.103'/g" filename.txt ... (1 Reply)
Discussion started by: vivek d r
1 Replies

7. Shell Programming and Scripting

Search for a particular field length and append '0' if less less than 10

Hi, I am new to Unix. Please help me in finding solution for the below scenario. I have a flat file that contains data like 378633410|3013505414|new_378633410|ALBERT|WALLS|378633410|Rew||||||| 351049045|239|new_351049045|JIM|COOK|351049045|Rew|||||||... (6 Replies)
Discussion started by: anandek
6 Replies

8. Shell Programming and Scripting

Find max length of the field and then replace zero

hai guys, pick the 1st field and calculate max length. if suppose max length is 2, then compare the all records if <2 then add zero's prefix of the record. for ex: s.no,sname 1,djud 37,jtuhe in this max length of the 1st field is 2 right the output wil be s.no,sname 01,djud... (6 Replies)
Discussion started by: Suneelbabu.etl
6 Replies

9. Shell Programming and Scripting

Need to replace last field in a file,if first field matches

Hi, Need to replace last field in a file(/etc/passwd) ,if first filed matches with particular username. Scenario: cat testfor1 deekshi:x:7082:7082::/home/deekshi:/bin/bash harini1:x:7083:7083::/home/harini1:/bin/bash Here,if first field contains "deekshi", then i should replace... (4 Replies)
Discussion started by: Sumanthsv
4 Replies

10. Shell Programming and Scripting

How to replace value in each field until a certain character in each record?

Each record coming with column names. I have to replace them in each record as shown below TIME=20181219110000261|CHAN=FMBKHJBAAAADPCFNAAAAAABA|EVNT=SWIclst|VALU=Session FMBKHJBAAAADPCFNAAAAAABA started|SRC=NSS|UCPU=0|SCPU=0 Output should look like: ... (9 Replies)
Discussion started by: sudhakar1987
9 Replies
AUTOGRID(1)						      General Commands Manual						       AUTOGRID(1)

NAME
autogrid - preparing protein and ligand for AutoDock analysis SYNOPSIS
autogrid4 [options] -p gridparameterfile DESCRIPTION
AutoGrid prepares a 3D grid representation of the non-covalent interaction energies that various user-specified ligand atom types will experience around a user-specified target macromolecule. In addition, the electrostatic potential and desolvation free energy grid maps may also be calculated. The grid maps are stored in plain text files with the extension '.map' and are required by AutoDock 4 to perform dockings. AutoGrid also outputs a '.xyz' file which describes the spatial extents of the grid box, and an AVS field '.fld' file which describes the consistent set of atomic affinity grid maps that were calculated together for a given target macromolecule. Note: it is nec- essary to compute grid maps for all the atom types in the ligand or set of ligands that will be docked, as well as an electrostatic poten- tial grid map and a desolvation free energy map. For example, if a ligand has an aliphatic carbon and a hydrogen-bond-accepting oxygen atom, it would be necessary to compute both a 'C' map and an 'OA' map. See http://autodock.scripps.edu/faqs-help/faq/where-do-i-set-the- autodock-4-force-field-parameters for more information about AutoDock 4 atom types. The input to AutoGrid is best prepared with the program suite AutoDockTools. There is no way to run autodock4 without a grid. OPTIONS
-o Use old PDBq format (q in columns 55-61) -u Usage information, also -h on Debian. -d Increased verbosity of messages to help debugging. -l logfile -p filename Specifies Grid Parameter File EXAMPLE
A range of tests is made available with the AutoGrid sources that can be used as follows: $ D=/usr/share/doc/autogrid/Tests $ cd /tmp $ ln -s $D/AD4_parameters.dat . $ gunzip -c $D/hsg1_sm.pdbqt.gz > hsg1_sm.pdbqt $ autogrid4 -p $D/hsg1_no_receptor_types.gpf -l hsg1_no_receptor_types.glg This command prepares grid map files for each of the AutoDock atom types specified in the grid parameter file (in this case: hsg1_sm.A.map, hsg1_sm.C.map, hsg1_sm.d.map, hsg1_sm.e.map, hsg1_sm.HD.map, hsg1_sm.NA.map, hsg1_sm.N.map, hsg1_sm.OA.map), the AVS field file (hsg1_sm.maps.fld) and hsg1_sm.maps.xyz. To perform the cocking calculation, AutoDock should be executed, though it demands a separate docking parameter file (with extension .dpf). The 'DPF' refers to the grid map files that are necessary to the docking and allows the setting of other important parameters, such as the search method and how many dockings to perform. SEE ALSO
autodock(1), runAdt(1). http://autodock.scripps.edu LICENSE
This software is made available under the terms of the GNU Public License version 2 or later. This implies that this software may be redistributed if the source is made available. It would however help the future development of the AutoDockSuite if you register yourself at http://autodock.scripps.edu/downloads. AUTHOR
The most prominent author of the version 4 of AutoDock is G. Morris <garrett@scripps.edu>. See the AUTHORS file in /usr/share/doc/autogrid for details. This manual page was written by Steffen Moeller <moeller@debian.org> and much revised by upstream author Garrett Morris. It was prepared for the Debian project but may be used by others and is hopefully adopted by the upstream developers. Juli 23, 2007 AUTOGRID(1)
All times are GMT -4. The time now is 05:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy