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
How to read the value from a specific line and column in to a csh variable Radamez Shell Programming and Scripting 2 01-09-2009 04:19 AM
How to read a specific value from a Log file? cooolthud Shell Programming and Scripting 8 04-17-2008 11:30 AM
read specific text from a log file ragha81 Shell Programming and Scripting 4 10-17-2006 01:17 PM
Shell Script to read specific lines in a file varshanswamy Shell Programming and Scripting 5 08-22-2005 07:12 PM
read a file as input and pass each line to another script sajjad02 Shell Programming and Scripting 0 09-24-2004 11:13 PM

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 02-26-2009
samura samura is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 6
A script that read specific fileds from the 7th line in a file

Dear All,

I need a unix script that will read the 7th line and especially these fileds from a file Mo speed 16, Mt speed 15 every 15 minutes starting from 00:00 to 23:45 on daily basis and put the result in a txt file and name it MT_MO_20090225.txt, please also note that the system date format is Thu Feb 26 17:16:28 GMT-1 2009.

Please find attached SAMPLE of the file.

Waiting for your positive response.

Rgrds,

Ali
Attached Files
File Type: txt file.TXT (1.9 KB, 21 views)
  #2 (permalink)  
Old 02-26-2009
cfajohnson's Avatar
cfajohnson cfajohnson is offline Forum Advisor  
Shell programmer, author
  
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,361
Quote:
Originally Posted by samura View Post
Dear All,

I need a unix script that will read the 7th line

To read the 7th line from a file:

Code:
{ read; read; read; read; read; read; read line7; } < FILENAME
Or:

Code:
line7=$( sed -n '7{p
q
}' FILENAME  )
  #3 (permalink)  
Old 02-27-2009
samura samura is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 6
Please note i have prepared the below script.

#!/bin/ksh
# A shell script to print the MO and MT license OF SMSC
# Written by Tom - Feb/27/2009
# --------------------------------
telnet 10.35.90.100
Username= user
Password=user
cd /home/smc/log/smcapp
cat smcapp.run.0 | awk -F, '{print $7 "," $8,"$9,"$10,"$11,"$12,"$13 }' >> SMSC_License_20090227.txt

Please note that i need to run this script from a different server and put the SMSC_License_20090227.txt in that server and needs to make theis script read from the file every second although the data generated in the file is every one minute.

Please check the above script and correct if there is any eeror.
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 04: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