Sponsored Content
Full Discussion: deleting lines from file
Top Forums Shell Programming and Scripting deleting lines from file Post 302400585 by Scott on Wednesday 3rd of March 2010 04:05:09 PM
Old 03-03-2010
Quote:
Originally Posted by joeyg
Could awk read the file, line-by-line into an array
then starting at element 51 begin writing back out to the same file?
Not like this:
Code:
awk  'NR >= START  {X[NR]=$0} END {for( x = START; x<=NR; x++ ) print X[x] }' START=51 file1 > file1

But you might get away with it like this:
Code:
awk  'NR >= START  {X[NR]=$0} END {for( x = START; x<=NR; x++ ) print X[x] > "file1"}' START=51 file1


Quote:
Originally Posted by anbu23
Code:
cat file | awk ' NR > 50 ' > file

Code:
cat file | sed -n "51,$ p" > file

Some UUOC's there!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

deleting lines in a log file

Is there an easy way to delete the first so many lines in a log file? like I have a log file that has 10000 lines, i want to just get rid of the first 9000. (2 Replies)
Discussion started by: BG_JrAdmin
2 Replies

2. Shell Programming and Scripting

Deleting last 2 lines from the file.

Hi I have a file & always I need to remove or delete last 2 lines from that file. So in a file if I have 10 lines then it should return me first 8 lines. Can someone help me? (4 Replies)
Discussion started by: videsh77
4 Replies

3. Shell Programming and Scripting

Deleting lines in a file

How do I delete all the lines after the line containing text ***DISCLOSURES*** . I want to delete this line too. Thank you (2 Replies)
Discussion started by: reachsamir
2 Replies

4. UNIX for Dummies Questions & Answers

Deleting whole lines from a file

I have a file with 65 sets of 35 coordinates, and would like to isolate these coordinates so that I can easily copy the coordinates to another file. The problem is, I've got a 9 line header before each set of coordinates (so each set is 44 lines long). There are a zillion threads out there about... (3 Replies)
Discussion started by: red baron
3 Replies

5. Shell Programming and Scripting

Deleting lines ending with . from a file

HI I'm looking to delete lines ending with .tk from below data file --------- abc.tk mgm.tk dtk mgmstk ------ I have written below code ---- sed '/.tk *$/d' dat_file.txt > temp.txt ---- But its deleting all the lines ending with tk. I need to delete only the lines ending .tk my... (5 Replies)
Discussion started by: shekhar_v4
5 Replies

6. UNIX for Advanced & Expert Users

Deleting lines from a file

How I can delete 100 lines anywhere in a file without opening a file and without renaming the file. (11 Replies)
Discussion started by: Nirgude07
11 Replies

7. Shell Programming and Scripting

Deleting certain new lines from a file with shell

Good morning!!! Im a newbie with shell programing and i was wondering if there is a way to delete certain new lines from a file, here is an example of my current file: >seq_0 GTGAGATTGCTAATGAGCTGCTTTTAGGGGGCGTGTTGTGCTTGCTTTCC AACTTTTCTAGATTGATTCTACGCTGCCTCCAGCAGCCACCCCTCCCATC... (11 Replies)
Discussion started by: machalita
11 Replies

8. Shell Programming and Scripting

Re: Deleting lines from big file.

Hi, I have a big (2.7 GB) text file. Each lines has '|' saperator to saperate each columns. I want to delete those lines which has text like '|0|0|0|0|0' I tried: sed '/|0|0|0|0|0/d' test.txt Unfortunately, it scans the file but does nothing. file content sample:... (4 Replies)
Discussion started by: dipeshvshah
4 Replies

9. Shell Programming and Scripting

Deleting specific lines in a file

Hello, I have a file filled with dates, such as: 04-08-2011 message 04-08-2011 message 03-08-2011 message 01-08-2011 message 31-07-2011 message 24-07-2011 message 15-07-2011 message 13-12-2008 message 26-11-2007 message And I want to delete those lines whose date is older than 10... (5 Replies)
Discussion started by: asanchez
5 Replies

10. Shell Programming and Scripting

Deleting selected lines in a file

Hi Guys , I have two files say a1 and a2 having following contents a1 dag wfd a2 dag wfd chire hcm I want to delete only the lines in a2 which are in a1 and final output of a2 should be a2 chire hcm (6 Replies)
Discussion started by: Pradeep_1990
6 Replies
START 
TRANSACTION(7) PostgreSQL 9.2.7 Documentation START TRANSACTION(7) NAME
START_TRANSACTION - start a transaction block SYNOPSIS
START TRANSACTION [ transaction_mode [, ...] ] where transaction_mode is one of: ISOLATION LEVEL { SERIALIZABLE | REPEATABLE READ | READ COMMITTED | READ UNCOMMITTED } READ WRITE | READ ONLY [ NOT ] DEFERRABLE DESCRIPTION
This command begins a new transaction block. If the isolation level, read/write mode, or deferrable mode is specified, the new transaction has those characteristics, as if SET TRANSACTION (SET_TRANSACTION(7)) was executed. This is the same as the BEGIN(7) command. PARAMETERS
Refer to SET TRANSACTION (SET_TRANSACTION(7)) for information on the meaning of the parameters to this statement. COMPATIBILITY
In the standard, it is not necessary to issue START TRANSACTION to start a transaction block: any SQL command implicitly begins a block. PostgreSQL's behavior can be seen as implicitly issuing a COMMIT after each command that does not follow START TRANSACTION (or BEGIN), and it is therefore often called "autocommit". Other relational database systems might offer an autocommit feature as a convenience. The DEFERRABLE transaction_mode is a PostgreSQL language extension. The SQL standard requires commas between successive transaction_modes, but for historical reasons PostgreSQL allows the commas to be omitted. See also the compatibility section of SET TRANSACTION (SET_TRANSACTION(7)). SEE ALSO
BEGIN(7), COMMIT(7), ROLLBACK(7), SAVEPOINT(7), SET TRANSACTION (SET_TRANSACTION(7)) PostgreSQL 9.2.7 2014-02-17 START TRANSACTION(7)
All times are GMT -4. The time now is 06:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy