Sponsored Content
Top Forums Shell Programming and Scripting awk or a combination of commands to read and calculate nth lines from pattern Post 303029923 by RavinderSingh13 on Sunday 3rd of February 2019 01:10:04 AM
Old 02-03-2019
Hello jessandr,

Not that much clear, please do mention why 1st value of header is NOT being picked up?

Thanks,
R. Singh
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Combination Of commands

Hello All, I just wanted to know what are the different ways of using commands in combination. The most common one which i know is using pipes. Also grouping is also done like ( ls; date) where output of both the commands is displayed. Are there any other ways of combining various... (2 Replies)
Discussion started by: rahulrathod
2 Replies

2. UNIX for Dummies Questions & Answers

combination of two commands

I want to show a output like this Lee Ballancore PID TTY TIME CMD 31799 pts/3 00:00:00 vim 31866 pts/3 00:00:00 vim 2495 pts/7 00:00:00 vim 8368 pts/0 00:00:00 vim 9544 pts/2 00:00:00 ps Alistairr Rutherford PID TTY TIME CMD 8368 pts/0 00:00:00 vim 9544 pts/2 00:00:00 ps ... (3 Replies)
Discussion started by: nehaquick
3 Replies

3. Shell Programming and Scripting

Advice using cut & echo combination commands

Hi, I am cutting data from a fixed length test file and then writing out a new record using the echo command, the problem I have is how to stop multiple spaces from being written to the output file as a single space. Example: cat filea | while read line do field1=`echo $line | cut -c1-2` ... (6 Replies)
Discussion started by: dc18
6 Replies

4. Shell Programming and Scripting

read lines between search pattern

I have a file split something like 01/11/2010: No of users 100 02/11/2010: No of users 102 03/11/2010: No of users 99 ... I want to search the file for a particular date and then extract the following line with the date, something like 02/11/2010 No of users 102 I can grep... (6 Replies)
Discussion started by: gefa
6 Replies

5. Shell Programming and Scripting

search pattern and read lines

Hi, I have a huge de-limited file which has pattern : 99"9876"2010-11-21 12:51:01"J"MNOPQRS ID# 2-1234-1234-0099-9876-0 "" <<read>> 99"9876"2010-11-21 12:51:01"K"R-EMP# 01234567 (LOGOFF) "" <<read>> 99"9876"2010-11-21 12:51:01"L" *AUTO LOGOFF* ... (3 Replies)
Discussion started by: angie1234
3 Replies

6. Shell Programming and Scripting

Using AWK to find top Nth values in Nth column

I have an awk script to find the maximum value of the 2nd column of a 2 column datafile, but I need to find the top 5 maximum values of the 2nd column. Here is the script that works for the maximum value. awk 'BEGIN { subjectmax=$1 ; max=0} $2 >= max {subjectmax=$1 ; max=$2} END {print... (3 Replies)
Discussion started by: ncwxpanther
3 Replies

7. Shell Programming and Scripting

Insert new pattern in newline after the nth occurrence of a line pattern - Bash in Ubuntu 12.04

Hi, I am getting crazy after days on looking at it: Bash in Ubuntu 12.04.1 I want to do this: pattern="system /path1/file1 file1" new_pattern=" data /path2/file2 file2" file to edit: data.db - I need to search in the file data.db for the nth occurrence of pattern - pattern must... (14 Replies)
Discussion started by: Phil3759
14 Replies

8. Shell Programming and Scripting

Help with parsing file with combination of pattern

I have a file1 like prt1|als28.1 prt3|als53.1 prt2|als550.1 prt1|bls9.2 prt2|als7.2 prt2|bls0.2 prt2|als872.1 prt1|bls871.1 prt2|als6.2 prt4|als22.1 prt2|bls43.2 I want to create a file2 from this file by comparing all the possible combinations of patterns (prt) assuming prt1... (3 Replies)
Discussion started by: sammy777
3 Replies

9. Shell Programming and Scripting

Optimize a combination of commands

Im currently running this command to satisfy a particular task. it works for my purposes. but i want to be able to optimize this string of commands and have it be reduced to 1 or 2 commands, if at all possible: head -4 datafile 2>/dev/null | cut -c1-400 | wc | awk '{print $2$1$3}' (5 Replies)
Discussion started by: SkySmart
5 Replies

10. UNIX for Beginners Questions & Answers

awk to remove pattern and lines above pattern

In the awk below I am trying to remove all lines above and including the pattern Test or Test2. Each block is seperated by a newline and Test2 also appears in the lines to keep but it will always have additional text after it. The Test to remove will not. The awk executed until the || was added... (2 Replies)
Discussion started by: cmccabe
2 Replies
curs_clear(3)						     Library Functions Manual						     curs_clear(3)

NAME
curs_clear, clear, wclear, erase, werase, clrtobot, wclrtobot, clrtoeol, wclrtoeol - Clear all or part of a Curses window SYNOPSIS
#include <curses.h> int clear( void ); int wclear( WINDOW *win ); int erase( void ); int werase( WINDOW *win ); int clrtobot( void ); int wclrtobot( WINDOW *win ); int clrtoeol( void ); int wclrtoeol( WINDOW *win ); LIBRARY
Curses Library (libcurses) STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: clear, wclear, erase, werase, clrtobot, wclrtobot, clrtoeol, wclrtoeol: XCURSES4.2 Refer to the standards(5) reference page for more information about industry standards and associated tags. DESCRIPTION
The erase and werase routines copy blanks to every position in the window. The clear and wclear routines are similar to erase and werase but also call clearok. The result is that the screen is cleared completely on the next call to wrefresh for that window and repainted from scratch. The clrtobot and wclrtobot routines erase all lines below the cursor in the window. In addition, these routines erase the current line to the right of the cursor, including the character on which the cursor is positioned. The clrtoeol and wclrtoeol routines erase the current line to the right of the cursor, including the character on which the cursor is posi- tioned. NOTES
The header file <curses.h> automatically includes the header file <stdio.h>. Note that erase, werase, clear, wclear, clrtobot, and clrtoeol may be macros. RETURN VALUES
Upon successful completion, these routines return OK; otherwise, they return ERR. SEE ALSO
Functions: curses(3), curs_outopts(3), curs_refresh(3) Others: standards(5) curs_clear(3)
All times are GMT -4. The time now is 12:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy