Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Take the 2nd line from the bottom Post 302761267 by grep_me on Friday 25th of January 2013 11:19:12 AM
Old 01-25-2013
Looks like you are using a regular expression with grep. (if ^ is part of data, escape the character )
Try using egrep and with quotes

Code:
SIZE_SCR=`egrep '^scr' /rsi/logs/csc_summary_size_check.log | tail -1 | cut -d";" -f4 | cut -b1-3`
SIZE_VORHER_SCR=`egrep '^scr' /rsi/logs/csc_summary_size_check.log | tail -2 | cut -d";" -f4 | cut -b1-3 | head -1`

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Get the line count from 2nd line of the file ?

Hi, I want to get the line count of the file from the 2nd line of the file ? The first line is header so want to skip that. Thanks. (8 Replies)
Discussion started by: smc3
8 Replies

2. Shell Programming and Scripting

Get the bottom line of a file to the top of the file

Hi, i have a small requirement where i have to get the bottom most line from a file to the topmost position. a small example is shown below.. $ cat beep.txt It is first documented as being played in southern England. In the 16th century. By the end of the 18th century, Cricket is a... (5 Replies)
Discussion started by: Shellslave
5 Replies

3. Shell Programming and Scripting

perl search and replace - search in first line and replance in 2nd line

Dear All, i want to search particular string and want to replance next line value. following is the test file. search string is tmp,??? ,10:1 "???" may contain any 3 character it should remain the same and next line replace with ,10:50 tmp,123 --- if match tmp,??? then... (3 Replies)
Discussion started by: arvindng
3 Replies

4. UNIX for Dummies Questions & Answers

Help with editing 2nd line after match

Hi All I would like to break down each next line that matches SK1.chr* in this case NNNNNN.... into 100 characters each after SK1.chr*... (3 Replies)
Discussion started by: pawannoel
3 Replies

5. Shell Programming and Scripting

Search for string and print top and bottom line

Hi Folks I need a one liner to parse through a log and if the string is found print the line above, the line with the string and the line below. example: The ball is green and blue Billy through the ball higer. Jane got hurt with the ball. So if I search for Billy I would need the 3... (1 Reply)
Discussion started by: bombcan
1 Replies

6. Shell Programming and Scripting

1st column,2nd column on first line 3rd,4th on second line ect...

I need to take one column of data and put it into the following format: 1st line,2nd line 3rd line,4th line 5th line,6th line ... Thanks! (6 Replies)
Discussion started by: batcho
6 Replies

7. Shell Programming and Scripting

How to read file line by line and compare subset of 1st line with 2nd?

Hi all, I have a log file say Test.log that gets updated continuously and it has data in pipe separated format. A sample log file would look like: <date1>|<data1>|<url1>|<result1> <date2>|<data2>|<url2>|<result2> <date3>|<data3>|<url3>|<result3> <date4>|<data4>|<url4>|<result4> What I... (3 Replies)
Discussion started by: pat_pramod
3 Replies

8. UNIX for Beginners Questions & Answers

How to get 2nd last column of the line- UNIX?

I want to retrieve Status from below example. Columns numbers will be dynamic but Status will always be 2nd last- JobName StartTime EndTime Status ExitCode autorep -j $jobName | grep '^FR' | awk -F' ' '{print $2}' The above code gives me the 2nd column from start of the line. (7 Replies)
Discussion started by: Tanu
7 Replies

9. Shell Programming and Scripting

How do we display specific row of an output from bottom given line number?

I pass a number to my script. Passing "1" below. ./getfile.sh 1 echo "User entered: $1" ls -ltr *.conf | sed -n '$p' I wish to use ls -ltr i.e list files in ascending order of time the latest showing at the bottom of the output. Number 1 should get me the last row of ls -ltr output i.e... (9 Replies)
Discussion started by: mohtashims
9 Replies
XZGREP(1)							     XZ Utils								 XZGREP(1)

NAME
xzgrep - search compressed files for a regular expression SYNOPSIS
xzgrep [grep_options] [-e] pattern file... xzegrep ... xzfgrep ... lzgrep ... lzegrep ... lzfgrep ... DESCRIPTION
xzgrep invokes grep(1) on files which may be either uncompressed or compressed with xz(1), lzma(1), gzip(1), or bzip2(1). All options specified are passed directly to grep(1). If no file is specified, then the standard input is decompressed if necessary and fed to grep(1). When reading from standard input, gzip(1) and bzip2(1) compressed files are not supported. If xzgrep is invoked as xzegrep or xzfgrep then egrep(1) or fgrep(1) is used instead of grep(1). The same applies to names lzgrep, lze- grep, and lzfgrep, which are provided for backward compatibility with LZMA Utils. ENVIRONMENT
GREP If the GREP environment variable is set, xzgrep uses it instead of grep(1), egrep(1), or fgrep(1). SEE ALSO
grep(1), xz(1), gzip(1), bzip2(1), zgrep(1) Tukaani 2009-07-05 XZGREP(1)
All times are GMT -4. The time now is 02:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy