Sponsored Content
Top Forums Shell Programming and Scripting Read line with particular number of lines Post 302769852 by krux_rap on Wednesday 13th of February 2013 04:25:57 PM
Old 02-13-2013
Read line with particular number of lines

Hi all,

I have a file sample.txt
Code:
abc
asd
adf
daf
adw
add
adv
wdf

I want to control the number of lines to read

Like if i give input as ./script_name 2 5

required output
Code:
asd
adf
daf
adw

ultimate i need a script which reads the particular number of lines and
runs nohup automatiocally in bash

Code:
nohup script_name asd &
nohup script_name adf &
.........


thanks

Moderator's Comments:
Mod Comment Please use code tags next time for your code and data.

Last edited by radoulov; 02-13-2013 at 06:57 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to get the line number from while read

I have a file TXTPROCESS.TXT.20071129 in which line 1 contains the file name and rest of the records are data. The file data looks like this: TXTPROCESS.TXT.20071129 DIVD20071129 INTR20071129 BALN20071129 From line 2 onwards the first 4 characters defines individual process. What I... (2 Replies)
Discussion started by: skymirror
2 Replies

2. Shell Programming and Scripting

Appending line number to each line and getting total number of lines

Hello, I need help in appending the line number of each line to the file and also to get the total number of lines. Can somebody please help me. I have a file say: abc def ccc ddd ffff The output should be: Instance1=abc Instance2=def Instance3=ccc Instance4=ddd Instance5=ffff ... (2 Replies)
Discussion started by: chiru_h
2 Replies

3. Shell Programming and Scripting

cat file1 read line-per-line then grep -A 15 lines down in fileb

STEP 1 # Set variable FILE=/tmp/mainfile SEARCHFILE =/tmp/searchfile # THIS IS THE MAIN FILE. cat /tmp/mainfile Interface Ethernet0/0 "outside", is up, line protocol is up Hardware is i82546GB rev03, BW 100 Mbps Full-Duplex(Full-duplex), 100 Mbps(100 Mbps) MAC address... (6 Replies)
Discussion started by: irongeekio
6 Replies

4. Shell Programming and Scripting

How to read n number of lines from a file

Hiii I am very new to shell scripting.This is my data file a.txt: 56 45.78 1000 11.23 76.89 45 34.56 23 3400 100 .......... Now i am must use shell scripting to read n number of lines from the file & from ts n number of lines i need to find greatest number among them & so on for... (44 Replies)
Discussion started by: varsha
44 Replies

5. UNIX for Dummies Questions & Answers

Read directory files and count number of lines

Hello, I'm trying to create a BASH file that can read all the files in my working directory and tell me how many words and lines are in that file. I wrote the following code: FILES="*" for f in "$FILES" do echo -e `wc -l -w $f` done My issue is that my file is outputting in one... (4 Replies)
Discussion started by: jl487
4 Replies

6. Shell Programming and Scripting

bash: read file line by line (lines have '\0') - not full line has read???

I am using the while-loop to read a file. The file has lines with null-terminated strings (words, actually.) What I have by that reading - just a first word up to '\0'! I need to have whole string up to 'new line' - (LF, 10#10, 16#A) What I am doing wrong? #make file 'grb' with... (6 Replies)
Discussion started by: alex_5161
6 Replies

7. Shell Programming and Scripting

add number in lines line by line in different files

I have a set of log files that are in the following format ======= set_1 ======== counter : 315 counter2: 204597 counter3: 290582 ======= set_2 ======== counter : 315 counter2: 204597 counter3: 290582 ======= set_3 ======== counter : 315 counter2: 204597 counter3: 290582 Is... (6 Replies)
Discussion started by: grandguest
6 Replies

8. UNIX for Dummies Questions & Answers

How to read contents of a file from a given line number upto line number again specified by user

Hello Everyone. I am trying to display contains of a file from a specific line to a specific line(let say, from line number 3 to line number 5). For this I got the shell script as shown below: if ; then if ; then tail +$1 $3 | head -n $2 else ... (5 Replies)
Discussion started by: grc
5 Replies

9. Shell Programming and Scripting

Write $line number into textfile and read from line number

Hello everyone, I don't really know anything about scripting, but I have to manage to make this script, out of necessity. #!/bin/bash while read -r line; do #I'm reading from a big wordlist instructions using $line done Is there a way to automatically write the $line number the script... (4 Replies)
Discussion started by: bobylapointe
4 Replies

10. Shell Programming and Scripting

Need a program that read a file line by line and prints out lines 1, 2 & 3 after an empty line...

Hello, I need a program that read a file line by line and prints out lines 1, 2 & 3 after an empty line... An example of entries in the file would be: SRVXPAPI001 ERRO JUN24 07:28:34 1775 REASON= 0000, PROCID= #E506 #1065: TPCIPPR, INDEX= 003F ... (8 Replies)
Discussion started by: Ferocci
8 Replies
ADW(4)							   BSD Kernel Interfaces Manual 						    ADW(4)

NAME
adw -- Advansys PCI 16bit SCSI Host adapter driver SYNOPSIS
To compile this driver into the kernel, place the following lines in your kernel configuration file: device pci device scbus device adw DESCRIPTION
This driver provides access to the 16bit SCSI bus connected to the Advanced Systems Products, Inc. ASC3550 Ultra, and ASC38C0800 Ultra2, SCSI Host Adapter chips. Both chips support, synchronous transfers (20MHz and 40MHz max respectively), 16bit transfers, tagged queueing, and up to 253 concurrent SCSI transactions. Per target configuration performed in the AdvanceWare menu, which is accessible at boot, is honored by this driver. This includes synchro- nous/asynchronous transfers, maximum synchronous negotiation rate, wide transfers, disconnection, tagged queueing, and the host adapter's SCSI ID. The global setting for the maximum number of tagged transactions allowed per target is not honored as the CAM SCSI system will automatically determine the maximum number of tags a device can receive as well as guarantee fair resource allocation among devices. HARDWARE
The adw driver supports SCSI controllers including: o AdvanSys ABP940UW/ABP3940UW o AdvanSys ABP950UW o AdvanSys ABP970UW o AdvanSys ABP3940U2W o AdvanSys ABP3950U2W SEE ALSO
adv(4), cd(4), da(4), sa(4), scsi(4) HISTORY
The adw driver appeared in FreeBSD 3.0. AUTHORS
The adw driver was ported by Justin T. Gibbs from the Linux driver written by Bob Frey of Advanced System Products, Inc. Many thanks to AdvanSys for providing the original driver under a suitable license for use in FreeBSD. BSD
July 14, 2004 BSD
All times are GMT -4. The time now is 12:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy