LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-07-2004, 06:28 PM   #1
zero79
Member
 
Registered: Nov 2003
Location: Ohio
Distribution: Debian Unstable
Posts: 460

Rep: Reputation: 30
how to enumerate first line of text file to standard output?


hi, i need to parse only the first line of a text file, and i'm trying to come up with a bash script that will first of all enumerate only the first line to the user. i'm trying to use awk to do this, but i can't figure out what i need to do to get it to recognize a new line as the field separator. this is what i have so far:

Code:
awk -F\n '{print $1}' text.txt
the \n doesn't seem to work as i would expect (the full text in the file still gets listed). what is the best way to do this? thanks for any thoughts.

Last edited by zero79; 07-07-2004 at 06:30 PM.
 
Old 07-07-2004, 06:37 PM   #2
zero79
Member
 
Registered: Nov 2003
Location: Ohio
Distribution: Debian Unstable
Posts: 460

Original Poster
Rep: Reputation: 30
5 minutes of digging and i answer my own question...hehe

Code:
head -1 text.txt
peace.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
C++ text file line by line/each line to string/array Dimitris Programming 15 03-11-2008 08:22 AM
sending data to standard out and to a text file at the same time. liguorir Linux - Software 1 08-23-2005 12:14 PM
How do I forward standard and error output into same file? ivj Linux - Software 5 07-19-2005 08:30 PM
Command to output file content line by line aznluvsmc Programming 2 09-12-2004 07:45 PM
How to redirect standard output of piped command to log file andrewstr Linux - General 10 02-04-2004 02:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:39 AM.

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