Sponsored Content
Full Discussion: GREP for sorting
Top Forums UNIX for Dummies Questions & Answers GREP for sorting Post 302753971 by siya@ on Wednesday 9th of January 2013 08:41:32 PM
Old 01-09-2013
GREP for sorting

Hi ,

I have a file which has a large number of sequences of type:

Code:
gi_1
AASSKSKSKSSKSKSK....
series_121
DDKFKFKGKGKH
gi_3
FFFFLFFLFLFLF
series_1
DFFFFFF
pattern_3
GEEEEEEEEE
gi_2
HKKGGKGKGK
series_102
HHHHH
pattern_1
HHHHH

In order to list all the sequences under gi I do
grep "gi" filename>outputfile
it gives me list of all gi .

However I want to list all of the sequences as shown below.I want to basically know the order like gi_1 followed by series_1 and by gi_3

Code:
gi_1
series_121
gi_3
series_1
pattern_3
gi_2
series_102
pattern_1


Is it possible to get all this in a single file and that too in the order they appear in file?

Should i do a multiple grep command to get all these names in a single file to get the order.


Thanks
Sia

Last edited by Scott; 01-10-2013 at 10:58 AM.. Reason: Please use code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

grep sorting/formatting

Hi, I currently have many log files for different webpages inside the folder /log/. The program allows the user to enter a month and then the grep function searches for it, the command i used is below: grep -c "$month" ./log/*.log This works and i can ascertain the number of matches, but I... (10 Replies)
Discussion started by: Jaken
10 Replies

2. Shell Programming and Scripting

Sorting :

Hi .... iam having a file with 20,000 rows and 56 colums. Iam trying to sort a file ....for that iam using 'sort' command. If iam having 3 and 5 key colums etc ... as numerical this 'sort' command will work? what ihave to do ? sample example : E100|0|19940102|1|11111|E003... (3 Replies)
Discussion started by: satyam_sat
3 Replies

3. UNIX for Dummies Questions & Answers

Sorting using count, grep and count

Hi, I trying to sort information in a file by making count for every object. For example: A B A D A B C i would like to sort out count for each object (A's, B's and etc) but in actual case i dont know the object but i know the position ofthe object. do i need to use array as well? Any... (2 Replies)
Discussion started by: sukhpal_78
2 Replies

4. Shell Programming and Scripting

MEM=`ps v $PPID| grep -i db2 | grep -v grep| awk '{ if ( $7 ~ " " ) { print 0 } else

Hi Guys, I need to set the value of $7 to zero in case $7 is NULL. I've tried the below command but doesn't work. Any ideas. thanks guys. MEM=`ps v $PPID| grep -i db2 | grep -v grep| awk '{ if ( $7 ~ " " ) { print 0 } else { print $7}}' ` Harby. (4 Replies)
Discussion started by: hariza
4 Replies

5. Shell Programming and Scripting

AWK/GREP sorting help

hi everyone, I am kind of new to this forum. I need help in sorting this data out accordingly, I am actually doing a traceroute application and wants my AS path displayed in front of my address like this; 192.168.1.1 AS28513 AS65534 AS5089 AS5089 .... till the last AS number and if possible sort... (8 Replies)
Discussion started by: sam127
8 Replies

6. Shell Programming and Scripting

sorting

Hii guys, I need to sort my file and remove duplicates before writing to another file. The first line in the file are column names. I dont want this line to be sorted and should always be the first line in the output. sort -u file.txt > file1.txt. is the command that i am using... (4 Replies)
Discussion started by: just4u_sharath
4 Replies

7. Homework & Coursework Questions

Shell Script: Sorting by column using grep/awk

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: You will write a script that will read a tab-separated file that contains the names of all 50 states &... (7 Replies)
Discussion started by: tburns517
7 Replies

8. Shell Programming and Scripting

Inconsistent `ps -eaf -o args | grep -i sfs_pcard_load_file.ksh | grep -v grep | wc -l`

i have this line of code that looks for the same file if it is currently running and returns the count. `ps -eaf -o args | grep -i sfs_pcard_load_file.ksh | grep -v grep | wc -l` basically it is assigned to a variable ISRUNNING=`ps -eaf -o args | grep -i sfs_pcard_load_file.ksh |... (6 Replies)
Discussion started by: wtolentino
6 Replies

9. Shell Programming and Scripting

Sorting

Hi, I've got two arrays 1 3 5 7 2 4 6 8 and i need to write a shell script to get the output 1 2 3 4 5 6 7 8 without using sort or bubble sort. (0 Replies)
Discussion started by: web2moha
0 Replies

10. Shell Programming and Scripting

Sorting

I do sort on the date and Time chronologically, how can I make the NIL to be below in the output Input file: KT NIL NIL ZK 02/09/2016 18:11 CD NIL NIL AS 02/09/2016 18:22 AB 02/08/2016 18:17 VA 02/09/2016 18:50 CX 02/09/2016 18:10 sort -b -k 2.9,2.10 -k 2.1,2.2 -k 2.4,2.5 -k... (3 Replies)
Discussion started by: aydj
3 Replies
PAPS(1) 						      General Commands Manual							   PAPS(1)

NAME
paps - UTF-8 to PostScript converter using Pango SYNOPSIS
paps [options] files... DESCRIPTION
paps reads a UTF-8 encoded file and generates a PostScript language rendering of the file. The rendering is done by creating outline curves through the pango ft2 backend. OPTIONS
These programs follow the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included below. --landscape Landscape output. Default is portrait. --columns=cl Number of columns output. Default is 1. Please notice this option isn't related to the terminal length as in a "80 culums terminal". --font=desc Set the font description. Default is Monospace 12. --rtl Do right to left (RTL) layout. --paper ps Choose paper size. Known paper sizes are legal, letter and A4. Default is A4. Postscript points Each postscript point equals to 1/72 of an inch. 36 points are 1/2 of an inch. --bottom-margin=bm Set bottom margin. Default is 36 postscript points. --top-margin=tm Set top margin. Default is 36 postscript points. --left-margin=lm Set left margin. Default is 36 postscript points. --right-margin=rm Set right margin. Default is 36 postscript points. --gutter-width=gw Set gutter width. Default is 40 postscript points. --help Show summary of options. --header Draw page header for each page. --markup Interpret the text as pango markup. --lpi Set the lines per inch. This determines the line spacing. --cpi Set the characters per inch. This is an alternative method of specifying the font size. --stretch-chars Indicates that characters should be stretched in the y-direction to fill up their vertical space. This is similar to the texttops behaviour. AUTHOR
paps was written by Dov Grobgeld <dov.grobgeld@gmail.com>. This manual page was written by Lior Kaplan <kaplan@debian.org>, for the Debian project (but may be used by others). April 17, 2006 PAPS(1)
All times are GMT -4. The time now is 02:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy