Sponsored Content
Full Discussion: Help in awk/bash
Top Forums Shell Programming and Scripting Help in awk/bash Post 302753869 by bioinfo on Wednesday 9th of January 2013 01:27:02 PM
Old 01-09-2013
Its working Smilie
Code:
 printf("The following entry from line %d is for Branch %d:\n%s",
            FNR, entry, r[entry]) > no

But if I want to print the full line as well as branch. Also, I want serial no.
Required output:
Code:
(001) The following entry from entry 5 "print full line here" is for branch 2711:
# Branch 2711 is printed here
(002) The following entry from entry 9 "print full line here" is for branch 2716:
# Branch 2716 is printed here
(003) The following entry from entry 13 "print full line here" is for branch 2916:
# Branch 2916 is printed here

Then, using other file (2.txt having one column of some serial numbers) I wish to retreive those branches from above output corresponding to values from 2.txt. For example, I want to retreive 002 from above output:
Required output:
Code:
(002) The following entry from entry 9 "print full line here" is for branch 2716:
# Branch 2716 is printed here

Please guide.
Thanks

Last edited by bioinfo; 01-09-2013 at 03:42 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

BASH with AWK

Hello, I have a file.txt with 20000 lines and 2 columns each which consists of current_filename and new_filename . I want to create a script to find files in a directory with current_filename and move it to new folder with new_filename. Could you please help me how to do that?? ... (2 Replies)
Discussion started by: narasimhulu
2 Replies

2. Shell Programming and Scripting

Is there any better way for sorting in bash/awk

Hi, I have a file which is:- 1 6 4 8 2 3 2 1 9 3 2 1 3 3 5 6 3 1 4 9 7 8 2 3 I would like to sort from field $2 to field $6 for each of the line to:- 1 2 3 4 6 8 2 1 1 2 3 9 3 1 3 3 5 6 4 2 3 7 8 9 I came across this Arrays on example 26-6. But it is much complicated. I am... (7 Replies)
Discussion started by: ahjiefreak
7 Replies

3. Shell Programming and Scripting

awk bash help

Hi, I'm trying to read a file containing lines with spaces in them. The inputfile looks like this ------------------------------ Command1 arg1 arg2 Command2 arg5 arg6 arg7 ------------------------------- The shell code looks like this... lines=`awk '{ print }' inputfile` ... (2 Replies)
Discussion started by: a-gopal
2 Replies

4. Shell Programming and Scripting

scripting help with bash and awk

I'm trying to reformat some tide information into a useable format and failing. Input file is.... 4452 CHENNAI (MADRAS) 13°06'N, 80°18'E India East Coast 01 June 2009 UT(GMT) Data Area 3. Indian Ocean (northern part) and Red Sea to Singapore 01/06/2009 00:00 0.7 m 00:20 0.7 m 00:40... (3 Replies)
Discussion started by: garethsays
3 Replies

5. UNIX for Dummies Questions & Answers

Help with BASH/AWK queries ....

Hi Everyone, I have an input file in the following format: score.file1.txt contig00045 length=566 numreads=19 1047 0.0 contig00055 length=524 numreads=7 793 0.0 contig00052 length=535 numreads=10 607 e-176 contig00072 length=472 numreads=46 571 e-165... (8 Replies)
Discussion started by: Fahmida
8 Replies

6. Shell Programming and Scripting

AWK/Bash script

I would like to write a script to extend this command to a general case: BEGIN {s_0=0;n_0=0}{n_0++;s_0+=($51-$1)^2}END {print sqrt(s_0/n_0)} i.e. so that BEGIN {s_0=0;n_0=0}{n_0++;s_0+=($51-$1)^2}END {print sqrt(s_0/n_0)} BEGIN {s_1=0;n_1=0}{n_1++;s_1+=($51-$2)^2}END {print... (3 Replies)
Discussion started by: chrisjorg
3 Replies

7. UNIX for Dummies Questions & Answers

Help in awk/bash

Hi, I am also a newbie in awk and trying to find solution of my problem. I have one reference file 1.txt with 2 columns and I want to search other 10 files (a.txt, b.txt......h.txt each with 5 columns) corresponding to the values of 2nd column from 1.txt. If the value from 2nd column from 1.txt... (0 Replies)
Discussion started by: bioinfo
0 Replies

8. Shell Programming and Scripting

Help in awk/bash

Hi, I have two files: atom.txt and g.txt atom.txt has multiple patterns but I am showing only two patterns each ending with ENDMDL: ATOM 1 N SER A 1 35.092 83.194 140.076 1.00 0.00 N ATOM 2 CA SER A 1 35.216 83.725 138.725 1.00 0.00 C TER ENDMDL ATOM 1 N SER A 1 35.683 81.326 139.778 1.00... (11 Replies)
Discussion started by: bioinfo
11 Replies

9. Shell Programming and Scripting

Returning a value from awk to bash

Hi I am a newbie starting bash and I have a simple need to return the result of an operation from awk to bash. basically I want to use awk to tell me if "#" exists in a string, and then back in bash, i want to do an IF statement on this return in order to do other things. In my bash shell I... (2 Replies)
Discussion started by: oahmad
2 Replies

10. UNIX for Dummies Questions & Answers

New problem with awk using bash

Hi! I have a new problem with awk, this time I think is because I'm using it in bash and I don't know how to put the valor of the variable in awk. Here is the code: #!/bin/bash for i in 1 2 3 4 5 do a=$i b=$ awk '$1>=a&&$1<=b {print $1,$2,$3}'>asdf test... (3 Replies)
Discussion started by: florpi
3 Replies
SVK::Command::Branch(3) 				User Contributed Perl Documentation				   SVK::Command::Branch(3)

NAME
SVK::Command::Branch - Manage a project with its branches SYNOPSIS
branch --create BRANCH [DEPOTPATH] branch --list [--all] branch --create BRANCH [--tag] [--local] [--switch-to] [--from|--from-tag BRANCH|TAG] [DEPOTPATH] branch --move BRANCH1 BRANCH2 branch --merge BRANCH1 BRANCH2 ... TARGET branch --checkout BRANCH [PATH] [DEPOTPATH] branch --delete BRANCH1 BRANCH2 ... branch --setup DEPOTPATH branch --push [BRANCH] branch --pull [BRANCH] branch --offline [BRANCH] branch --online [BRANCH] OPTIONS
-l [--list] : list branches for this project --listprojects : list avaliable projects --create : create a new branch --tag : create in the tags directory --local : targets in local branch --delete [--rm|del]: delete BRANCH(s) --checkout [--co] : checkout BRANCH in current directory --switch-to : switch the current checkout to another branch (can be paired with --create) --merge : automatically merge all changes from BRANCH1, BRANCH2, etc, to TARGET --project : specify the target project name --push : move changes to wherever this branch was copied from --pull : sync changes from wherever this branch was copied from --setup : setup a project for a specified DEPOTPATH --from BRANCH : specify the source branch name --from-tag TAG : specify the source tag name -C [--check-only] : try a create, move or merge operation but make no changes -P [--patch] FILE : Write the patch between the branch and where it was copied from to FILE --export : used with --checkout to create a detached copy --offline : takes the current branch offline, making a copy under //local --online : takes the current branch online, pushing changes back to the mirror path, and then switches to the mirror DESCRIPTION
SVK provides tools to more easily manage your project's branching and merging, so long as you use the standard "trunk/, branches/, tags/" directory layout for your project or specifically tell SVK where your branches live. Usage (without projects) A very simple sample usage might be to checkout the trunk from a project you want to work on but don't have upstream commit rights for. This allows you to maintain a local branch and to send in patches. Assuming you have alread mirrored this repository to //mirror/Project svk co //mirror/Project/trunk or svk branch --co trunk //mirror/Project/ and then svk branch --offline You're now working in a local branch, make local commits and changes as you need to. If you want to bring in changes from your remote repository, you can pull them down svk branch --pull To see what changes you've made, you can create a patch between the local branch and the remote repository svk branch -P - --push If you have commit rights to the remote repository, you can also svk branch --push to send your changes. You can use svk branch's branching capability in this mode, but it will be much friendlier if you set up a project Usage (projects) To initialize a project in a repository, run the setup command svk branch --setup //mirror/Project If you have the standard trunk branches tags directories svk will offer them as the starting point. In fact, if you have trunk branches and tags directories, svk will try to use them without neeting --setup, but you won't be able to use the --project flag and will need to use depotpaths in commands. The rest of this documentation assumes you've set up a project called Example in //mirror/Project If you're in a working copy of svk where it can work out the Project name, you can leave off the --project flag from the examples below, but you can branch/tag/merge without having working copies Branching To check out the trunk, you can run svk branch --co trunk --project Example To create a branch for release engineering svk branch --create Exmaple-1.0-releng --project Example Since you have a checkout of trunk already, you can convert that cd trunk svk branch --switch-to Example-1.0-releng Or you can get a clean checkout svk branch --co Example-1.0-releng --project Example If changes are made on trunk and you wish to bring them down to the release engineering branch, you can do that with the branch merge command svk branch --merge trunk Example-1.0-releng If you're cautious, use the check flags first: svk branch -C --merge trunk Example-1.0-releng svk branch -P - --merge trunk Example-1.0-releng These will show you what svk wants to do. Lets say you want to add a feature to trunk but work on a branch so you don't inconvenience others who are working on trunk: svk branch --create Feature --project Example work on your feature, svk ci some changes svk branch --merge Feature trunk --project Example continue to bring down changes several ways svk branch --pull svk branch --merge trunk Feature svk branch --merge trunk . (if you're in a working copy of the branch) and then merge back more feature work as you need to To get rid of a branch when you're done with it svk branch --delete Feature --project Example To see all of your branches, you can do: svk branch --list --project Example Tagging If you've been working on your releng branch and are ready to cut a release, you can easily create a tag svk branch --tag --create 1.0rc1 --from Example-1.0-releng --project Example If you would like to check out this tag, use svk branch --tag --co 1.0rc1 --project Example Project Property Details SVK branch also provides another project loading mechanism by setting properties on root path. Current usable properties for SVK branch are 'svk:project:<projectName>:path-trunk' 'svk:project:<projectName>:path-branches' 'svk:project:<projectName>:path-tags' These properties are useful when you are not using the standard "trunk/, branches/, tags/" directory layout. For example, a mirrored depotpath '//mirror/projA' may have trunk in "/trunk/projA/" directory, branches in "/branches/projA", and have a standard "/tags" directory. Then by setting the following properties on root path of remote repository, it can use SVK branch to help manage the project: 'svk:project:projA:path-trunk => /trunk/projA' 'svk:project:projA:path-branches => /branches/projA' 'svk:project:projA:path-tags => /tags' Be sure to have all "path-trunk", "path-branches" and "path-tags" set at the same time. perl v5.10.0 2008-09-13 SVK::Command::Branch(3)
All times are GMT -4. The time now is 05:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy