Sponsored Content
Top Forums Shell Programming and Scripting How to start reading from the nth line till the last line of a file. Post 302592257 by machomaddy on Monday 23rd of January 2012 10:54:28 AM
Old 01-23-2012
Thanks!
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Reading a file line by line and processing for each line

Hi, I am a beginner in shell scripting. I have written the following script, which is supposed to process the while loop for each line in the sid_home.txt file. But I'm getting the 'end of file' unexpected for the last line. The file sid_home.txt gets generated as expected, but the script... (6 Replies)
Discussion started by: sagarparadkar
6 Replies

2. Shell Programming and Scripting

[Solved] Problem in reading a file line by line till it reaches a white line

So, I want to read line-by-line a text file with unknown number of files.... So: a=1 b=1 while ; do b=`sed -n '$ap' test` a=`expr $a + 1` $here do something with b etc done the problem is that sed does not seem to recognise the $a, even when trying sed -n ' $a p' So, I cannot read... (3 Replies)
Discussion started by: hakermania
3 Replies

3. Shell Programming and Scripting

Reading a file after nth line

I know how to read a file line by line. But don't to how to skip to a line matching a criteria and then continue reading it till the end. This is a log file. The input is a timestamp. 1. Find the timestamp in the log file 2. Read the remaining lines one at a time till EOF. How can I do... (9 Replies)
Discussion started by: avinthm
9 Replies

4. Shell Programming and Scripting

Reading text file, comparing a value in a line, and placing only part of the line in a variable?

I need some help. I would like to read in a text file. Take a variable such as ROW-D-01, compare it to what's in one line in the text file such as PROD/VM/ROW-D-01 and only input PROD/VM into a variable without the /ROW-D-01. Is this possible? any help is appreciated. (2 Replies)
Discussion started by: xChristopher
2 Replies

5. Shell Programming and Scripting

Reading line by line from live log file using while loop and considering only those lines start from

Hi, I want to read a live log file line by line and considering those line which start from time stamp; Below code I am using, which read line but throws an exception when comparing line that does not contain error code tail -F /logs/COMMON-ERROR.log | while read myline; do... (2 Replies)
Discussion started by: ketanraut
2 Replies

6. Shell Programming and Scripting

Bash script to read a file from particular line till required line and process

Hi All, Am trying to write wrapper shell/bash script on a utility tool for which i need to pass 2 files as arugment to execute utility tool. Wraper script am trying is to do with above metion 2 files. utility tool accepts : a. userinfo file : which contains username b. item file : which... (2 Replies)
Discussion started by: Optimus81
2 Replies

7. UNIX for Beginners Questions & Answers

Insert a line of text on nth line of a file

Hi All, I am using UNix Sun OS sun4u sparc SUNW,SPARC-Enterprise My intention is to insert a line of text after 13th line of every file inside a particular directory. While trying to do it for a single file , i am using sed sed '3 i this is the 4th line' filename sed: command garbled: 3... (5 Replies)
Discussion started by: gotamp
5 Replies

8. Shell Programming and Scripting

Printing string from last field of the nth line of file to start (or end) of each line (awk I think)

My file (the output of an experiment) starts off looking like this, _____________________________________________________________ Subjects incorporated to date: 001 Data file started on machine PKSHS260-05CP ********************************************************************** Subject 1,... (9 Replies)
Discussion started by: samonl
9 Replies

9. UNIX for Beginners Questions & Answers

Reading a file line by line and print required lines based on pattern

Hi All, i want to write a shell script read below file line by line and want to exclude the lines which contains empty value for MOUNTPOINT field. i am using centos 7 Operating system. want to read below file. # cat /tmp/d5 NAME="/dev/sda" TYPE="disk" SIZE="60G" OWNER="root"... (4 Replies)
Discussion started by: balu1234
4 Replies
NDSELECT(1)							   User Commands						       NDSELECT(1)

NAME
ndselect - select lines and fields for numdiff DESCRIPTION
Usage: ndselect -h|--help|-v|--version or ndselect [-b N][-e N][-s N][-F N][-L N][-I N][-S IFS][-x][-l PATH][-o PATH] [FILE] Print to standard output a subset of lines and fields from a given file. The argument after the options is the name of the file to read from. The complete path of the file should be given, a directory name is not accepted. If no input file is specified, the program reads from the standard input. Exit status: 0 in case of normal termination, -1 (255) in case of error -b, --beginning, --start=N Set to N the number of the first line to print (The default behavior is to start with line number 1) -e, --end=N Set to N the number of the last line that can be printed (The default behavior is to arrive till to the end of the file) -s, --step=N Set to N the increment to use when selecting the lines to print (The default value for the increment is 1) -F, --first-field=N Set to N the number of the first field to print (The default behavior is to start with field number 1) -L, --last-field=N Set to N the number of the last field that can be printed (The default behavior is to arrive till to the end of every line) -I, --increment=N Set to N the increment to use when selecting the fields to print (The default value for the increment is 1) -S, --separator=IFS Specify the set of characters to use to split the input lines into fields (The default set of characters is space, tab and newline). -x, --omit-empty-lines Do not print empty lines -l, --warnings-to=PATH Redirect warning and error messages from stderr to the indicated file -o, --output=PATH Redirect output from stdout to the indicated file -h, --help Show this help message -v, --version Show version number, Copyright, Distribution Terms and NO-Warranty COPYRIGHT
Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Ivano Primi <ivprimi@libero.it> License GPLv3+: GNU GPL version 3 or later, see <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO
The full documentation for ndselect is maintained as a Texinfo manual. If the info and ndselect programs are properly installed at your site, the command info numdiff should give you access to the complete manual. ndselect 5.6.0 January 2012 NDSELECT(1)
All times are GMT -4. The time now is 04:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy