LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-03-2008, 04:07 AM   #1
santhoshv
LQ Newbie
 
Registered: Apr 2008
Posts: 8

Rep: Reputation: 0
Problem with SED command


Hi,

I am using korn shell and I am using the following command to delete the 1st line of the file Testfile.xml

sed '1d' Testfile.xml > output.xml

I experience a strange problem where this command also deletes the last line of the inputfile.

Please help me in tracing out what would be the issue...?

Thanks
SaNv..
 
Old 04-03-2008, 04:31 AM   #2
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
Works for me:
Code:
$ cat test.dat
line 1 of test data
line 2 of test data
line 3 of test data
line 4 of test data
$ sed '1d' test.dat
line 2 of test data
line 3 of test data
line 4 of test data
Can you post your data file? It would be best if you could upload it somewhere without modifications, rather than copy-pasting parts of it. I am thinking you might have some strange embedded characters in the file which might account of the problem.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
sed command Problem gizmo1007 Linux - Newbie 2 02-18-2008 06:17 PM
shell scripting problem, sed command kamkos Linux - General 5 03-31-2007 09:39 PM
SED command problem vikasumit Linux - General 8 07-06-2006 12:33 PM
problem with sed command LFS 6.0 obsidianblackha Linux From Scratch 6 12-07-2004 10:31 AM
bash Problem with "sed" command blubbfish Linux - Newbie 3 06-01-2004 10:14 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration