Shell Script needed urgently


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell Script needed urgently
# 1  
Old 03-11-2005
Data Shell Script needed urgently

Hi Frends,

I am need of a small shell script. Kindly any body help me by giving me a small shell script to read first line in a file and extract date from the first line
and store it in a variable...
and after storing it in a variable the first and the last line of the file has to be deleted..



file format

#EOD rate on 20050403 on <time>
.
.
.
.
data
.
.

#EOF

Thanx in advance.!!!

Kavi Smilie

Last edited by vas_dba; 03-11-2005 at 07:44 AM..
# 2  
Old 03-11-2005
head -1 filename will get the first line.
assuming only the first and last lines are the commented ones, this will strip them out: grep -v '^#' filename > newfile
# 3  
Old 03-11-2005
to remove the first line of the file.
Code:
sed "1 d" file1

If last line has no new line char

to remove the last line,
Code:
sed "$ d" file1

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need Help Urgently - ksh Script

Requirement is to list the files older than 365 days from multiple directories and delete them and log the list of files which are deleted to a log file. so 1 script should only list files older than 365 days for each directory separately to a folder The other script should read these files... (4 Replies)
Discussion started by: prasadn
4 Replies

2. Shell Programming and Scripting

Help needed urgently. Look back for files in PERL

I have 3 variables $file =abc_2011_11_01.txt (current day file) $back = Yes $forward = No I need to search for 3 days back files / 3 days forward files if my current file is not present logic is, I need to download the current day file. If it is missing, i need to look out for... (1 Reply)
Discussion started by: irudayaraj
1 Replies

3. UNIX for Advanced & Expert Users

Please correct my script - Needed very urgently

hello all, I have a script, used to search for the strings from the set of 5 similar pattern file from the log dir. So here it goes . The input parameter is a part of the file name. When during the script execution, the script should parse the input parameter to original file's with the same... (1 Reply)
Discussion started by: raghunsi
1 Replies

4. Shell Programming and Scripting

Script command - need help urgently

I have added script command to the .profile of the id, whose session needs to be captured. When exit command is issued, the script command exits. Is there a way to exit the parent shell also - and log off the system completely with one exit command? (8 Replies)
Discussion started by: ggayathri
8 Replies

5. UNIX for Advanced & Expert Users

Help needed Urgently... Thanks in advance

You have a file called /opt/test/input.txt with the following information: man_aa_bld_100.410.040_CMD 08/14/2008 23:29:21 08/14/2008 23:31:10 SU 5339491/1 man_aa_bld_100.410.050_CMD 08/14/2008 23:29:21 08/14/2008 23:31:11 SU 5339491/1 man_aa_bld_100.410.060_CMD 08/14/2008 ... (3 Replies)
Discussion started by: jkumsi
3 Replies

6. Shell Programming and Scripting

Help need urgently for oracle cursors in k shell scripting

Hi, My Oracle Stored procedure returns sys_refcursor to shell script. I have to iterate through it in script and use those retrieved values further in my script. I am using K Shell Scrpting. Stored Procedure is: create or replace PROCEDURE p_test(job_id IN VARCHAR2, c1 OUT SYS_REFCURSOR)... (4 Replies)
Discussion started by: rajeshorpu
4 Replies

7. Shell Programming and Scripting

bash shell scripting error need help urgently

#! /bin/sh abcd = "Hello world" if then echo $abcd fi i got error message that line3 : abcd: command not found line5 : [0: command not found line5 : [1: command not found i have no idea why i got this message. Can some one help me ??? (6 Replies)
Discussion started by: bonosungho
6 Replies

8. UNIX for Dummies Questions & Answers

Help NEEDED urgently on exceutable file

Hi , i amtrying to execute a file called bcs_maint which is the final executable for our project. Normally on some other servers ican execute it by just typing bcs_maint. yesterday i got a new worksattion for me and when i do the same it says /sbin/sh: bcs_maint : not found. What... (5 Replies)
Discussion started by: jagan_kalluri
5 Replies

9. Shell Programming and Scripting

help needed urgently

hi all i need help I am confused and stucked. Actually i am new in this scripting stuff. I want to give complete txt file as a input to a variable and then sort the data in the file according to the alpha numeric characters, as my text file contains ! and !! and !!! indicating Minor, Major and... (11 Replies)
Discussion started by: nabmufti
11 Replies

10. UNIX for Dummies Questions & Answers

Major Help Urgently Needed!!!!

Right deleted Linux partition usig windows then went to format c:\ but had to exit window now pc ONLY boots into GNU Grub. Does anyone know how to format the hard drive now????? (3 Replies)
Discussion started by: billett05
3 Replies
Login or Register to Ask a Question