Sponsored Content
Full Discussion: Remove first line of file
Top Forums UNIX for Beginners Questions & Answers Remove first line of file Post 303032800 by Scrutinizer on Sunday 24th of March 2019 11:34:43 AM
Old 03-24-2019
Try:
Code:
sed 1d file > newfile

Code:
tail -n+2 file > newfile

Code:
awk NR-1 file > newfile

With bash:
Code:
{
  read
  while IFS= read -r line
  do
    printf "%s\n" "$line"
  done
} < file > newfile


Last edited by Scrutinizer; 03-24-2019 at 12:41 PM..
This User Gave Thanks to Scrutinizer For This Post:
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remove every third line from a file

I need to remove every second and every third line from a file. My idea was to do it in two operations. First every third line, then every second line. The problem is that i can't find out how to do it. I tried to look for some sed oneliners, but couldn't find any. Suggestions? (4 Replies)
Discussion started by: bistru
4 Replies

2. Shell Programming and Scripting

Remove header(first line) and trailer(last line) in ANY given file

Hi, I need some help in removing the header (first line) and the trailer (last line) in a give file... The data file actually comes in EBCDIC format and I converted it into ASCII.. Now I need to strip off the first line and the last line.. I think we can use sed to do something like this:... (2 Replies)
Discussion started by: madhunk
2 Replies

3. Shell Programming and Scripting

How to remove last line of the file

hi sir, i need help..how to remove last line of the each file for example i have files a.txt ,b.txt and so on..i wanted to delete last list of each file..the patten not same for each file..any help? thanks in advance (3 Replies)
Discussion started by: mani_um
3 Replies

4. UNIX for Dummies Questions & Answers

remove a line within a file

Hi all, i have a text file similar to belowA1 A2 A3 B1 ... .... *** # first occurance B1 ... .... *** # second occurance B1 ... .... *** # third occurance My desired output is B1 ... .... *** # second occurance B1 ... .... *** # third occurance I want to remove the first line that is after... (3 Replies)
Discussion started by: new2ss
3 Replies

5. Shell Programming and Scripting

Remove a line from a file

Hi ,guys. I have one question: I want to write a script which removes a line with certain string from a file, for example The name of the file is: "passwd", the contents of it is below: ************************* ... brownj2:x:5000: hynesp:x:5001: leeb:x:5002 dioxna:x:5003 ... ... (2 Replies)
Discussion started by: daikeyang
2 Replies

6. Shell Programming and Scripting

Remove line from file

Hi!!! When I use vi editor my file looks like this: aaa2: 123.45^M aaa1: 11.34^M aaa3: aaa3: 15.56^M How to remove only line 3 ??? Thanks!!! (7 Replies)
Discussion started by: tdev457
7 Replies

7. Shell Programming and Scripting

Remove first line of file

Is there an easy way to remove the first line of a file so that the file: aaron benjamin cecilia daniel elliot fernando would become benjamin cecilia daniel elliot fernando (4 Replies)
Discussion started by: locoroco
4 Replies

8. Shell Programming and Scripting

How to remove last line of the file

Hi, unix gurus, I need to remove last line of the file. anybody can help me thanks in advance (7 Replies)
Discussion started by: ken002
7 Replies

9. Shell Programming and Scripting

Remove line from file and read file line by line

I have a file output.txt. File looks like this name1 10 name2 2 name3 5 I get a number n and I need to remove all lines which has number (after name) smaller or equal to n number. After that I need to write lines from file and my output must be like this: Output: 'name1 10' Output: 'name2... (1 Reply)
Discussion started by: kubo12312
1 Replies
NNTIDY(1)						      General Commands Manual							 NNTIDY(1)

NAME
nntidy - tidy your personal .newsrc file SYNOPSIS
nntidy [ -aciNQrsuv ] [ group ]... DESCRIPTION
nntidy will clean out non-existing groups, adjust obviously wrong article numbers, and remove badly formed lines from your .newsrc file. It may optionally remove ignored groups, unsubscribed groups, and groups which are not part of your presentation sequence or the groups specified on the command line. You should run nntidy if your rc file has been corrupted for some reason. OPTIONS
-a Equivalent to -cisu. -c Remove unrecognized lines. This will also remove the `options' line used by some older news readers, such as readnews(1) -i Remove entries for groups which are ignored in the database, e.g. entries marked with `X' in the GROUPS file. -r Remove entries for unsubscribed groups. -s Remove entries which are not included in the group presentation sequence defined in the init file. If one or more groups are speci- fied on the command line, entries not matched by these groups (and their subgroups etc) will be removed. Notice that depending on how you construct the presentation sequence, this may cause unsubscribed groups to be removed from .newsrc, but this will not normally happen. -u Truncate entries for unsubscribed groups, by removing the article numbers and leaving only the news group name and the `!' mark. -v Verbose operation. Reports each change made to the .newsrc file. -N No update mode. The requested operations are performed, but the result is not written back to disk. This can be used with the -v option to see whether tidying is required. -Q Quiet operation. The version information is not printed. FILES
~/.newsrc The record of read articles ~/.newsrc.tidy The original rc file before tidy SEE ALSO
nn(1), nncheck(1), nngoback(1), nngrab(1), nngrep(1), nnpost(1) nnadmin(1M), nnusage(1M), nnmaster(8) AUTHOR
Kim F. Storm, Texas Instruments A/S, Denmark E-mail: storm@texas.dk 4th Berkeley Distribution Release 6.6 NNTIDY(1)
All times are GMT -4. The time now is 11:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy