Sponsored Content
Top Forums Shell Programming and Scripting Print every 5 4th column values as separate row with different first column Post 302771447 by DGPickett on Wednesday 20th of February 2013 04:20:21 PM
Old 02-20-2013
Code:
ct=0 suf=0 kr=
while read x x x k
do
 kr="$kr $k"
 if (( ++ct > 4 ))
  then
   echo "peak$(( ++suf ))$kr"
   ct=0 kr=
  fi
 done < input

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to read the column and print the values under that column

hi all:b:, how to read the column and print the values under that column ...?? file1 have something like this cat file1 ======= column1, column2,date,column3,column4..... 1, 23 , 12/02/2008,...... 2, 45, 14/05/2008,..... 3, 56, 16/03/2008,..... cat file2 =======... (6 Replies)
Discussion started by: gemini106
6 Replies

2. Shell Programming and Scripting

print unique values of a column and sum up the corresponding values in next column

Hi All, I have a file which is having 3 columns as (string string integer) a b 1 x y 2 p k 5 y y 4 ..... ..... Question: I want get the unique value of column 2 in a sorted way(on column 2) and the sum of the 3rd column of the corresponding rows. e.g the above file should return the... (6 Replies)
Discussion started by: amigarus
6 Replies

3. Shell Programming and Scripting

Remove duplicates within row and separate column

Hi all I have following kind of input file ESR1 PA156 leflunomide PA450192 leflunomide CHST3 PA26503 docetaxel Pa4586; thalidomide Pa34958; decetaxel docetaxel docetaxel I want to remove duplicates and I want to separate anything before and after PAxxxx entry into columns or... (1 Reply)
Discussion started by: manigrover
1 Replies

4. UNIX for Dummies Questions & Answers

awk to print first row with forth column and last row with fifth column in each file

file with this content awk 'NR==1 {print $4} && NR==2 {print $5}' file The error is shown with syntax error; what can be done (4 Replies)
Discussion started by: cdfd123
4 Replies

5. Shell Programming and Scripting

awk Print New Column For Every Two Lines and Match On Multiple Column Values to print another column

Hi, My input files is like this axis1 0 1 10 axis2 0 1 5 axis1 1 2 -4 axis2 2 3 -3 axis1 3 4 5 axis2 3 4 -1 axis1 4 5 -6 axis2 4 5 1 Now, these are my following tasks 1. Print a first column for every two rows that has the same value followed by a string. 2. Match on the... (3 Replies)
Discussion started by: jacobs.smith
3 Replies

6. Shell Programming and Scripting

Print row on 4th column to all row

Dear All, I have input : SEG901 5173 9005 5740 SEG902 5227 5284 SEG903 5284 5346 SEG904 5346 9010 SEG905 5400 5456 SEG906 5456 5511 SEG907 5511 9011 SEG908 5572 9015 SEG909 5622 9020 SEG910 5678 5739 SEG911 5739 5796 SEG912 5796 9025 ... (3 Replies)
Discussion started by: attila
3 Replies

7. Shell Programming and Scripting

Read 4th column and print those many rows

Hi, My input file chr1 3217769 3217789 2952725-5 255 + chr1 3260455 3260475 2434087-6 255 - My desired output chr1 3217769 3217789 2952725-1 255 + chr1 3217769 3217789 2952725-2 255 + chr1 3217769 3217789 2952725-3 255 + chr1 3217769 3217789 2952725-4 255 +... (7 Replies)
Discussion started by: jacobs.smith
7 Replies

8. Shell Programming and Scripting

Changing values only in 3rd column and 4th column

#cat file testing test! nipw asdkjasjdk ok! what !ok host server1 check_ssh_disk!102.56.1.101!30!50!/ other host server 2 des check_ssh_disk!192.6.1.10!40!30!/ #grep check file| awk -F! '{print $3,$4}'|awk '{gsub($1,"",$1)}1' 50 30 # Output: (6 Replies)
Discussion started by: kenshinhimura
6 Replies

9. Shell Programming and Scripting

Print first row of column a, last row of column b if column a has the same value

I have a table with this structure: cola colb colc 1 19 lemon 20 31 lemon 32 100 lemon 159 205 cherries 210 500 cherries and need to parse it into this format: cola colb colc 1 100 lemon 159 500 cherries So I need the first row of cola and the last row of colb if colc has the... (3 Replies)
Discussion started by: coppuca
3 Replies

10. UNIX for Beginners Questions & Answers

If pattern in column 3 matches pattern in column 2 (any row), print value in column 1

Hi all, I have searched and searched, but I have not found a solution that quite fits what I am trying to do. I have a long list of data in three columns. Below is a sample: 1,10,8 2,12,10 3,13,12 4,14,14 5,15,16 6,16,18 Please use code tags What I need to do is as follows: If a... (4 Replies)
Discussion started by: bleedingturnip
4 Replies
APPLESINGLE(1)						    BSD General Commands Manual 					    APPLESINGLE(1)

NAME
applesingle, binhex, macbinary -- encode and decode files SYNOPSIS
<tool> probe file ... <tool> [decode] [-c] [-fv] [-C dir] [-o outfile] [file ...] <tool> -h | -V applesingle encode [-cfv] [-s suf] [-C dir] [-o outfile] file ... binhex encode [-R] [-cfv] [-s suf] [-C dir] [-o outfile] file ... macbinary encode [-t 1-3] [-cfv] [-s suf] [-C dir] [-o outfile] file ... DESCRIPTION
applesingle, binhex, macbinary are implemented as a single tool with multiple names. All invocations support the three verbs encode, decode, and probe. If multiple files are passed to probe, the exit status will be non-zero only if all files contain data in the specified encoding. OPTIONS
-f, --force perform the operation even if the output file already exists -h, --help display version and usage, then quit -v, --verbose be verbose -V, --version display version, then quit -c, --pipe, --from-stdin, --to-stdout For decode, read encoded data from the standand input. For encode, write encoded data to the standard output. Currently, "plain" data must be written to and from specified filenames (see also mount_fdesc(8)). -C, --directory dir create output files in dir -o, --rename name Use name for output, overriding any stored or default name. For encode, the appropriate suffix will be added to name. -o implies only one file to be encoded or decoded. -s, --suffix .suf override the default suffix for the given encoding -R, --no-runlength-encoding don't use BinHex runlength compression when encoding -t, --type 1-3 Specify MacBinary encoding type. Type 1 is undesirable because it has neither a checksum nor a signature and is thus difficult to recognize. DIAGNOSTICS
In general, the tool returns a non-zero exit status if it fails. Darwin 14 November 2005 Darwin
All times are GMT -4. The time now is 05:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy