Sponsored Content
Top Forums Shell Programming and Scripting Read from a file in unix(Continue from previous thread) Post 302716549 by pamu on Tuesday 16th of October 2012 02:46:33 PM
Old 10-16-2012
Quote:
Originally Posted by parthmittal2007
I have posted up
If there is no xyz present in test file how it can print that...????

assuming you have only single file


Code:
 file_name="$1" 
var="$2"

awk -F "=" -v VM="$var" -v FN="$file_name" '{if($1 ~ FN){s=1}
if(s && $1 == VM){print $2;s=""}}' file


Last edited by pamu; 10-16-2012 at 04:07 PM..
 

8 More Discussions You Might Find Interesting

1. Programming

How to implement read/write thread

How to implement read/write thread. This has to implemented at server side ar at client side? (1 Reply)
Discussion started by: shilpi_gup
1 Replies

2. UNIX for Dummies Questions & Answers

UNIX command to skip any warning messages and continue job execution

Hello All, Good day! This is my first UNIX post. :D Anyways, I would like to seek help from you guys if you know of any UNIX command that will skip a warning message once it is encountered but continue to run the execution. Ok here's the situation in general: An encypted file is sent to... (2 Replies)
Discussion started by: jennah_rekka
2 Replies

3. Solaris

How can I output all previous Unix commands in Solaris to a file??

Hello friends: I login to solaris with a username/Password and I can see quite a lot of previous I use dbefore, it accumulates a lot, I hope to output them into a Command.txt file as reference, not copy/paste 1 by 1, is there any way I can collect all commands in batch then put into a file, ... (3 Replies)
Discussion started by: sunnysunnysunny
3 Replies

4. Post Here to Contact Site Administrators and Moderators

Gud to read u r Thread

Hi Neo , I was searching for Unix Certifications on Google and got u r thread: "unix-certification-most-needed-these-days.html" It was a gr8 read. Nice to know ur thoughts.. I m also a newbie to this Unix world and had a gr8 interst in it. I m learning shell scripting and other basics. Would... (2 Replies)
Discussion started by: paras.oriental
2 Replies

5. Shell Programming and Scripting

Read column values from previous and next line using awk

Hi, I have a csv file which contains data that looks something like this: Key1 Key2 Key3 New_Key1 New_Key2 New_Key3 102 30 0 - - - 102 40 1 30 40 50 102 50 2 40 50 ... (4 Replies)
Discussion started by: Nishi_Licious
4 Replies

6. UNIX for Advanced & Expert Users

How to find a string in a line in UNIX file and delete that line and previous 3 lines ?

Hi , i have a file with data as below.This is same file. But actual file contains to many rows. i want to search for a string "Field 039 00" and delete that line and previous 3 lines in that file.. Can some body suggested me how can i do using either sed or awk command ? Field 004... (7 Replies)
Discussion started by: vadlamudy
7 Replies

7. UNIX for Dummies Questions & Answers

AIX UNIX - script on how to extract from log file with previous date

Hello, I am new to this forum so any assistance would help. I am currently trying to develop a script that extract all data from a log file with has the previous day's date. $ <root@aixtest3> /var/log > more sudo.log May 13 10:52:10 aixtest3 local2:notice sudo: tbrath : TTY=unknown ; ... (14 Replies)
Discussion started by: Kslew82
14 Replies

8. Solaris

Rebooting Windows machine leads to continue sync reset on UNIX

Hello, We have Windows 10 machine connected to Sparc T5440 server via serial cable. We access the server from the Windows 10 machine using putty via serial connection. This allows us to access ILOM and Unix. We have recently noticed that whenever we reboot the windows machine (Windows 10),... (11 Replies)
Discussion started by: jasonu
11 Replies
Gtk2::PrintSettings(3)					User Contributed Perl Documentation				    Gtk2::PrintSettings(3)

NAME
Gtk2::PrintSettings HIERARCHY
Glib::Object +----Gtk2::PrintSettings METHODS
printsettings = Gtk2::PrintSettings->new printsettings = Gtk2::PrintSettings->new_from_file ($file_name) o $file_name (localized file name) May croak with a Glib::Error in $@ on failure. Since: gtk+ 2.12 printsettings = Gtk2::PrintSettings->new_from_key_file ($key_file, $group_name) o $key_file (Glib::KeyFile) o $group_name (string or undef) May croak with a Glib::Error in $@ on failure. Since: gtk+ 2.12 $settings->foreach ($func, $data=undef) o $func (scalar) o $data (scalar) string or undef = $settings->get ($key) o $key (string) $settings->set ($key, $value) o $key (string) o $value (string or undef) boolean = $settings->has_key ($key) o $key (string) $settings->load_file ($file_name) o $file_name (string) May croak with a Glib::Error in $@ on failure. Since: gtk+ 2.14 $settings->load_key_file ($key_file, $group_name) o $key_file (Glib::KeyFile) o $group_name (string or undef) May croak with a Glib::Error in $@ on failure. Since: gtk+ 2.14 double = $settings->get_printer_lpi Since: gtk+ 2.16 $settings->set_printer_lpi ($lpi) o $lpi (double) Since: gtk+ 2.16 integer = $settings->get_resolution_x Since: gtk+ 2.16 $settings->set_resolution_xy ($resolution_x, $resolution_y) o $resolution_x (integer) o $resolution_y (integer) Since: gtk+ 2.16 integer = $settings->get_resolution_y Since: gtk+ 2.16 $settings->to_file ($file_name) o $file_name (localized file name) May croak with a Glib::Error in $@ on failure. Since: gtk+ 2.12 $settings->to_key_file ($key_file, $group_name) o $key_file (Glib::KeyFile) o $group_name (string or undef) Since: gtk+ 2.12 $settings->unset ($key) o $key (string) SEE ALSO
Gtk2, Glib::Object COPYRIGHT
Copyright (C) 2003-2008 by the gtk2-perl team. This software is licensed under the LGPL. See Gtk2 for a full notice. perl v5.12.1 2010-07-05 Gtk2::PrintSettings(3)
All times are GMT -4. The time now is 07:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy