Visit The New, Modern Unix Linux Community


Count special symbols between each unit


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Count special symbols between each unit
# 1  
Count special symbols between each unit

Can anybody help me figure this out? Thank you in advance.
I have a input file. It shows like this:
Code:
Query= random content
random content
> random content
random content
> random content
> random content

Query= random content
random content
random content
> random content
> random content

Query= random content
> random content

Query= random content
> random content
> random content
random content
random content
> random content
> random content
......

This file has multiple units and each unit's first line start with "Query=". The lines and content between each unit are random but the symbol ">" is always at the first position of a line. I want to list how many ">" in each units. So in this case, I am expecting the output file like this:
Code:
3
2  
1
4
......

# 2  
awk -v RS="" '{print gsub(/[>]/, "&")}' myFile
This User Gave Thanks to vgersh99 For This Post:
 

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #621
Difficulty: Medium
There is no switch statement in Python.
True or False?

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Simple unit script

Hello guys this is my first post in this forum. Since now ive been passive an ive only been looking for existing information. Now I could use specific help on a UNIX script i want to make that would: 1. Take 1-3 arguments. 2. Display the contents of its arguments, formatted as follows:... (7 Replies)
Discussion started by: banzomaster
7 Replies

2. HP-UX

Load average unit

Hi, On load average graph, unit is 100m, 200m, 300...800m. I don't understand what it means. Thx for helping (3 Replies)
Discussion started by: Michenux
3 Replies

3. Shell Programming and Scripting

Set of 2 records as one unit

Hi Experts, back at this forum again. Have a tab separated file like this --- ACCNN AMT(E/$) TYPE ID 11233 23.20($) AUTH 339 11233 19.00($) FINAL 339 11234 349.84($) AUTH 42332 11234 ... (12 Replies)
Discussion started by: PG3
12 Replies

4. Shell Programming and Scripting

Include special system characters in file count

Hi, I have a script that checks the length of each record/line in file - This seems to be working when there are no special systems character that are invisible or hidden. awk -v file=$file '{ if (filename==file) { k+=$5 if (length() <= 10 ){print size length(), "bytes " k} }... (2 Replies)
Discussion started by: asemota
2 Replies

5. UNIX for Advanced & Expert Users

Help with connecting 3 or 4 computers to one stereo unit

Nowadays I run Mandriva, Ubuntu and Fedora Core. All of the operating systems works fine on my computers. GRUB gives me the opportunity to select an operating system. I have Windows too. I don't run Windows. I like UNIX. Today I work with 3 computers with a single monitor. This is possible... (4 Replies)
Discussion started by: Angelo
4 Replies

6. Solaris

Special symbols in shell scripting

I am new to unix shell scripting, i was going through the existing shell scripts but couldn't able to get enough information on below syntaxes,i mean the symbols $# & $? used in the if loop. what exactly are they? what is the inline meaning, Could you please throw some light. Examples: 1) ... (4 Replies)
Discussion started by: Ariean
4 Replies

7. Shell Programming and Scripting

Migration unit testing process

Hi, We are doing migration from DB2 to Teradata. There are couple of things involving in the project. Please see below following order Autosys-Jil script Profile script Category1 Teradata script Data stage job script Tera data script Export files script.. Like that we have 10000... (1 Reply)
Discussion started by: onesuri
1 Replies

8. Shell Programming and Scripting

Urgent: How to eliminate special symbols in a file and how to read it

Hi, I have file called suppliersList.txt --------------------------------- 112|MIMUS|krish@google.com 113|MIMIRE|krish@google.com 114|MIMCHN|krish@google.com 115|CEL|krish@google.com 108|UGEN|krishn@google.com 109|SLAND|krish@google.com i have 3 varibale ------------- no Name... (4 Replies)
Discussion started by: kittusri9
4 Replies

9. Shell Programming and Scripting

Getting MAC from GPS unit

Never mind i got the answer thanks., (0 Replies)
Discussion started by: deaconf19
0 Replies

Featured Tech Videos