Sponsored Content
Full Discussion: Create specific output
Top Forums Shell Programming and Scripting Create specific output Post 302948790 by cmccabe on Thursday 2nd of July 2015 01:49:59 PM
Old 07-02-2015
Create specific output

I have a file that looks like the below and only need certain lines, but am not sure how to do that. It is basically everything from the @HD up to the @RG. Thank you Smilie.

file.txt - input
Code:
@HD    VN:1.4    GO:none    SO:coordinate @SQ    SN:chr1    LN:249250621 @SQ    SN:chr2    LN:243199373 @SQ    SN:chr3    LN:198022430 @SQ    SN:chr4    LN:191154276 @SQ    SN:chr5    LN:180915260 @SQ    SN:chr6    LN:171115067 @SQ    SN:chr7    LN:159138663 @SQ    SN:chr8    LN:146364022 @SQ    SN:chr9    LN:141213431 @SQ    SN:chr10    LN:135534747 @SQ    SN:chr11    LN:135006516 @SQ    SN:chr12    LN:133851895 @SQ    SN:chr13    LN:115169878 @SQ    SN:chr14    LN:107349540 @SQ    SN:chr15    LN:102531392 @SQ    SN:chr16    LN:90354753 @SQ    SN:chr17    LN:81195210 @SQ    SN:chr18    LN:78077248 @SQ    SN:chr19    LN:59128983 @SQ    SN:chr20    LN:63025520 @SQ    SN:chr21    LN:48129895 @SQ    SN:chr22    LN:51304566 @SQ    SN:chrX    LN:155270560 @SQ    SN:chrY    LN:59373566 @SQ    SN:chrM    LN:16569 @RG    ID:8AH6U.IonXpress_009    PL:IONTORRENT    PU:Unspecified/P1.1.17/IonXpress_009    FO:TACGTACGTCTGAGCATCGATCGATGTACAGCTACGTACGTCTGAGCATCGATCGATGTACAGCTACGTACGTCTGAGCATCGATCGATGTACAGCTACGTACGTCTGAGCATCGATCGATGTACAGCTACGTACGTCTGAGCATCGATCGATGTACAGCTACGTACGTCTGAGCATCGATCGATGTACAGCTACGTACGTCTGAGCATCGATCGATGTACAGCTACGTACGTCTGAGCATCGATCGATGTACAGCTACGTACGTCTGAGCATCGATCGATGTACAGCTACGTACGTCTGAGCATCGATCGATGTACAGCTACGTACGTCTGAGCATCGATCGATGTACAGCTACGTACGTCTGAGCATCGATCGATGTACAGCTACGTACGTCTGAGCATCGATCGATGTACAGCTACGTACGTCTGAGCATCGATCGATGTACAGCTACGTACGTCTGAGCATCGATCGATGTACAGCTACGTACGTCTGAGCATCGATCGATGTACAGCTACGTACG    DT:2015-06-03T14:03:02-0700    SM:E1    PG:tmap    KS:TCAGTGAGCGGAACGAT    CN:TorrentServer/Proton

Desired output
Code:
@HD    VN:1.4    GO:none    SO:coordinate @SQ    SN:chr1    LN:249250621 @SQ    SN:chr2    LN:243199373 @SQ    SN:chr3    LN:198022430 @SQ    SN:chr4    LN:191154276 @SQ    SN:chr5    LN:180915260 @SQ    SN:chr6    LN:171115067 @SQ    SN:chr7    LN:159138663 @SQ    SN:chr8    LN:146364022 @SQ    SN:chr9    LN:141213431 @SQ    SN:chr10    LN:135534747 @SQ    SN:chr11    LN:135006516 @SQ    SN:chr12    LN:133851895 @SQ    SN:chr13    LN:115169878 @SQ    SN:chr14    LN:107349540 @SQ    SN:chr15    LN:102531392 @SQ    SN:chr16    LN:90354753 @SQ    SN:chr17    LN:81195210 @SQ    SN:chr18    LN:78077248 @SQ    SN:chr19    LN:59128983 @SQ    SN:chr20    LN:63025520 @SQ    SN:chr21    LN:48129895 @SQ    SN:chr22    LN:51304566 @SQ    SN:chrX    LN:155270560 @SQ    SN:chrY    LN:59373566 @SQ    SN:chrM    LN:16569

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to create output like this

currently i have two clients connecting to my wifi router in telnet router, i typed the command : ~# dumpleases then it showed as following: Hostname Mac Address IP-Address billfan 00:15:00:15:c1:7e 192.168.11.100 00:16:cf:47:e7:ab... (4 Replies)
Discussion started by: billfanyang
4 Replies

2. Solaris

create user with RWX access to a specific directory in Solaris 10

I need to create a user account for a developer that will allow him rwx access to all resources in a directory. How can I do that? Thanks (5 Replies)
Discussion started by: gsander
5 Replies

3. Shell Programming and Scripting

Need help in writing a script to create a new text file with specific data from existing two files

Hi, I have two text files. Need to create a third text file extracting specific data from first two existing files.. Text File 1: Format contains: SQL*Loader: Release 10.2.0.1.0 - Production on Wed Aug 4 21:06:34 2010 some text ............so on...and somwhere text like: Record 1:... (1 Reply)
Discussion started by: shashi143ibm
1 Replies

4. AIX

create file and name it with same output name !

Guy's I have this command echo $? when I type it in AIX it will showme 0 I want when I type that command to create file in the same location with the same output of echo $? For exampl : I will execute the command now .... P_server/root/echo $? 0 the output is 0 so I want... (2 Replies)
Discussion started by: Mr.AIX
2 Replies

5. UNIX for Dummies Questions & Answers

Create File with specific Length

We have utility running on Unix which generates Files with records greater than 32760 , (max supported by Mainframe) .Our requirement is to transfer is file to Mainframe .When we ftp the in binary format it automatically wraps it up..so we are good there... But now we need to zip and send the file... (2 Replies)
Discussion started by: nishantrk
2 Replies

6. Shell Programming and Scripting

Create a specific bash to increase the automatic update on my pi

hi everyone, I just began to be interested about the bash access. I buy a time ago a Raspberry pi, I installed raspbmc and now I would like build a bash to copy everyday all new files inside my server directly on the hard drive in my Pi. So my HDD is directly plug on my pi with usb connect,... (4 Replies)
Discussion started by: nagito34
4 Replies

7. Shell Programming and Scripting

Create automated scan of specific directory using bash

I am trying to use bash to automate the scan of a specific directory using clamav. Having this in place is a network requirement. The below is an attempt to: 1. count the extensions (.txt, .jpeg) in a directory and write them to a virus-scan.log (section in bold) 2. scan each folder in the... (6 Replies)
Discussion started by: cmccabe
6 Replies

8. Shell Programming and Scripting

awk to create separate files but not include specific field in output

I am trying to use awk to create (in this example) 3 seperate text file from the unique id in $1 in file, if it starts with the pattern aa. The contents of each row is used to populate each text file except for $1 which is not needed. It seems I am close but not quite get there. Thank you :). ... (3 Replies)
Discussion started by: cmccabe
3 Replies

9. Programming

JAVA code to create file in Linux with specific permission

Hi All, I'm looking for JAVA code to create file in Linux with specific permission File should be created and saved in Linux in this path \opt\sys\doc by Java with this permission 764 Anyone can help to provide this Java code (3 Replies)
Discussion started by: AbuAliiiiiiiiii
3 Replies

10. Shell Programming and Scripting

Bash to create sub directories from specific file extension

In the bash below I am trying to create sub-directories inside a directory from files with specific .bam extensions. There may be more then one $RDIR ing the directory and the .bam file(s) are trimmed (removing the extension and IonCode_0000_) and the result is the folder name that is saved in... (2 Replies)
Discussion started by: cmccabe
2 Replies
Locale::Codes::LangExt(3pm)				 Perl Programmers Reference Guide			       Locale::Codes::LangExt(3pm)

NAME
Locale::Codes::LangExt - standard codes for language extension identification SYNOPSIS
use Locale::Codes::LangExt; $lext = code2langext('acm'); # $lext gets 'Mesopotamian Arabic' $code = langext2code('Mesopotamian Arabic'); # $code gets 'acm' @codes = all_langext_codes(); @names = all_langext_names(); DESCRIPTION
The "Locale::Codes::LangExt" module provides access to standard codes used for identifying language extensions, such as those as defined in the IANA language registry. Most of the routines take an optional additional argument which specifies the code set to use. If not specified, the default IANA language registry codes will be used. SUPPORTED CODE SETS
There are several different code sets you can use for identifying language extensions. A code set may be specified using either a name, or a constant that is automatically exported by this module. For example, the two are equivalent: $lext = code2langext('acm','alpha'); $lext = code2langext('acm',LOCALE_LANGEXT_ALPHA); The codesets currently supported are: alpha This is the set of three-letter (lowercase) codes from the IANA language registry, such as 'acm' for Mesopotamian Arabic. This is the default code set. ROUTINES
code2langext ( CODE [,CODESET] ) langext2code ( NAME [,CODESET] ) langext_code2code ( CODE ,CODESET ,CODESET2 ) all_langext_codes ( [CODESET] ) all_langext_names ( [CODESET] ) Locale::Codes::LangExt::rename_langext ( CODE ,NEW_NAME [,CODESET] ) Locale::Codes::LangExt::add_langext ( CODE ,NAME [,CODESET] ) Locale::Codes::LangExt::delete_langext ( CODE [,CODESET] ) Locale::Codes::LangExt::add_langext_alias ( NAME ,NEW_NAME ) Locale::Codes::LangExt::delete_langext_alias ( NAME ) Locale::Codes::LangExt::rename_langext_code ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangExt::add_langext_code_alias ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangExt::delete_langext_code_alias ( CODE [,CODESET] ) These routines are all documented in the Locale::Codes::API man page. SEE ALSO
Locale::Codes The Locale-Codes distribution. Locale::Codes::API The list of functions supported by this module. http://www.iana.org/assignments/language-subtag-registry The IANA language subtag registry. AUTHOR
See Locale::Codes for full author history. Currently maintained by Sullivan Beck (sbeck@cpan.org). COPYRIGHT
Copyright (c) 2011-2013 Sullivan Beck This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.18.2 2013-11-04 Locale::Codes::LangExt(3pm)
All times are GMT -4. The time now is 05:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy