The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Truncate multiple file extensions prvnrk Shell Programming and Scripting 12 04-04-2008 10:20 AM
Truncate last <n> characters from a file Gwailo88 UNIX for Dummies Questions & Answers 1 03-05-2008 12:52 AM
truncate file script is not working mvenkat_in Shell Programming and Scripting 3 10-24-2007 01:01 AM
how to truncate a large (8 GB) file kotasateesh Shell Programming and Scripting 1 07-05-2006 01:57 AM
Truncate what is It? rocker40 UNIX for Dummies Questions & Answers 2 10-11-2003 07:40 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-30-2007
rinku rinku is offline
Registered User
  
 

Join Date: May 2007
Posts: 54
Truncate File contain

I have one file which first line is blank and second line has some data.
$cat filename
output:

30-MAY-07
I want to store 30-MAY-07 value in one variable.
for that I wrote
var="`head -2 filename`"
It will give that result but I want to truncate the first line which is blank.

plz help.
  #2 (permalink)  
Old 05-30-2007
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,796
Code:
var=$(<filename)
echo $var
  #3 (permalink)  
Old 05-30-2007
anbu23 anbu23 is offline Forum Advisor  
Registered User
  
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,398
Code:
var=$( printf "%s" $(<filename) )
Code:
var=$( sed -n '2{p;q;}' filename)
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:24 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0