Sponsored Content
Top Forums Shell Programming and Scripting awk finding counting sequence Post 302568413 by yazu on Thursday 27th of October 2011 09:06:02 AM
Old 10-27-2011
Here is my code but it doesn't work. It's because of line ends. Somewhere you have dots, somewhere commas and in one line - 704/11 762,.
Code:
perl -F',\s+' -lane '                                                     :( 
BEGIN { $" = ", " }
sub normalize {
  my ($start, $end) = split "/", $_[0];
  if ($start > $end) {
    $end = substr($start, 0, length($start) - length($end)) . $end;
  }
  $_[0] = "$start/$end";
}
sub unwind {
  return if $_[0] !~ m|/|;
  normalize $_[0];
  my ($start, $end) = split "/", $_[0];
  my @v = $start .. $end;
  $_[0] = "@v";
}
$" = ", ";
unwind($_) for @F;
print "@F";
' INPUTFILE

This User Gave Thanks to yazu For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how can i isolate the random sequence of numbers using awk?

as you can see there is a delimiter after c8 "::". Awk sees the rest as fields because it doesn't recognize spaces and tabs as delimiters. So i am basically looking to isolate 20030003ba13f6cc. Can anyone help? c8::20030003ba13f6cc disk connected configured unknown (2 Replies)
Discussion started by: rcon1
2 Replies

2. Shell Programming and Scripting

Counting records with AWK

I've been working with an awk script and I'm wondeing id it's possible to count records in a file which DO NOT contain, in this instance fields 12 and 13. With the one script I am wanting to display the count for the records WITH fields 12 and 13 and a seperate count of records WITHOUT fields... (2 Replies)
Discussion started by: Glyn_Mo
2 Replies

3. Shell Programming and Scripting

Counting with Awk

I need "awk solution" for simple counting! File looks like: STUDENT GRADE student1 A student2 A student3 B student4 A student5 B Desired Output: GRADE No.of Students A 3 B 2 Thanks for awking! (4 Replies)
Discussion started by: saint2006
4 Replies

4. Shell Programming and Scripting

suffix a sequence in awk

hi I have a string pattern like ... ... 000446448742 00432265 040520100408 21974435 DEWSWATER GARRIER AAG IK4000 N 017500180000000000000000077000000000100 000446448742 00580937 040520100408 32083576 PEWSWATER BARRIER DAG GK4000 ... (6 Replies)
Discussion started by: zainravi
6 Replies

5. Shell Programming and Scripting

counting using awk

Hi, I want to perform a task using shell script. I am new to awk programming and any help would be greatly appreciated. I have the following 3 files (for example) file1: Name count Symbol chr1_1_50 10 XXXX chr3_101_150 30 YYYY File2: Name ... (13 Replies)
Discussion started by: Diya123
13 Replies

6. Shell Programming and Scripting

find common entries and match the number with long sequence and cut that sequence in output

Hi all, I have a file like this ID 3BP5L_HUMAN Reviewed; 393 AA. AC Q7L8J4; Q96FI5; Q9BQH8; Q9C0E3; DT 05-FEB-2008, integrated into UniProtKB/Swiss-Prot. DT 05-JUL-2004, sequence version 1. DT 05-SEP-2012, entry version 71. FT COILED 59 140 ... (1 Reply)
Discussion started by: manigrover
1 Replies

7. Shell Programming and Scripting

Counting Fields with awk

ok, so a user can specify options as is shown below: ExA: cpu.pl!23!25!-allow or ExB: cpu.pl!23!25!-block!all options are delimited by the exclamation mark. now, in example A, there are 4 options provided by the user. in example B, there are 5 options provided by the user. ... (3 Replies)
Discussion started by: SkySmart
3 Replies

8. Shell Programming and Scripting

awk counting question

Probably a simple to this, but unsure how to do it. I would prefer an AWK solution. Below is the data set. 1 2 3 2 5 7 4 6 9 1 5 4 8 5 7 1 1 10 15 3 12 3 7 9 9 8 10 4 5 2 9 1 10 4 7 9 7 12 6 9 13 8 For the second... (11 Replies)
Discussion started by: mollydog11
11 Replies

9. UNIX for Dummies Questions & Answers

awk code to reconstruct sequence from alignment

Hi Everyone, I need some help to construct a long 'Sbjct' string from the following input using incremental order of 'Sbjct' starting number (e.g. 26325115,33716368,33769033,34869860 etc.) Different 'Sbject' string will be separated by 'NNNN's as: ... (6 Replies)
Discussion started by: Fahmida
6 Replies

10. UNIX for Dummies Questions & Answers

Sequence of conditions awk

hello gurus, I want to use an associative array from a file to populate a field of another file, by matching several columns in order of priority. If the first column matches, then i dont want to match $2. Similarly I only want to match $3 when $1 and $2 are not in associative array. For the... (6 Replies)
Discussion started by: ritakadm
6 Replies
GETUNWIND(2)						     Linux Programmer's Manual						      GETUNWIND(2)

NAME
getunwind - copy the unwind data to caller's buffer SYNOPSIS
#include <syscall.h> #include <linux/unwind.h> long getunwind(void *buf, size_t buf_size); Note: There is no glibc wrapper for this system call; see NOTES. DESCRIPTION
Note: this function is obsolete. The IA-64-specific getunwind() system call copies the kernel's call frame unwind data into the buffer pointed to by buf and returns the size of the unwind data; this data describes the gate page (kernel code that is mapped into user space). The size of the buffer buf is specified in buf_size. The data is copied only if buf_size is greater than or equal to the size of the unwind data and buf is not NULL; otherwise, no data is copied, and the call succeeds, returning the size that would be needed to store the unwind data. The first part of the unwind data contains an unwind table. The rest contains the associated unwind information, in no particular order. The unwind table contains entries of the following form: u64 start; (64-bit address of start of function) u64 end; (64-bit address of end of function) u64 info; (BUF-relative offset to unwind info) An entry whose start value is zero indicates the end of the table. For more information about the format, see the IA-64 Software Conven- tions and Runtime Architecture manual. RETURN VALUE
On success, getunwind() returns the size of the unwind data. On error, -1 is returned and errno is set to indicate the error. ERRORS
getunwind() fails with the error EFAULT if the unwind info can't be stored in the space specified by buf. VERSIONS
This system call is available since Linux 2.4. CONFORMING TO
This system call is Linux-specific, and is available only on the IA-64 architecture. NOTES
This system call has been deprecated. The modern way to obtain the kernel's unwind data is via the vdso(7). Glibc does not provide a wrapper for this system call; in the unlikely event that you want to call it, use syscall(2). SEE ALSO
getauxval(3) COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. Linux 2017-09-15 GETUNWIND(2)
All times are GMT -4. The time now is 08:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy