print a function result in new file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting print a function result in new file
# 1  
Old 12-31-2007
print a function result in new file

Hi,

i have a function which return a variable .

serach ( paramatere) when i excute this function i get the result in the shell,

i want to print this result in a file by calling just the function.

how can i do it..

the code example is like that:

search ( )
{
..
}

the call must be done in the new file :

awk -F "," '{ {first=$1; sec=$2; tro=$3;quat=$4 }
if (tro == "")
{

$3 = search ( )

{print $1","$2","","$4} }
else
{print $1","$2","$3 $4}}' $file1 > $file2


i print the four variable in file1 delimitated by comma and i want to affect the result of function search to the variable $3?


when i write like that i don't have a result.
how can i do
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

To get or print specific value in result

i am executing below code to achive my result, but for second row the value is not coming it should come URL like other two . url start with http:// and end with .xhtml cat FILE | grep 'Test failed' | awk -F',' '{print $3,$8,$12}' INPUT 1517679173303,84,SKILLED LANGUAGE - ENTER... (11 Replies)
Discussion started by: mirwasim
11 Replies

2. Shell Programming and Scripting

Compare 2 columns from the same file and print a value depending on the result

Hello Unix gurus, I have a file with this format (example values): label1 1 0 label2 1 0 label3 0.4 0.6 label4 0.5 0.5 label5 0.1 0.9 label6 0.9 0.1 in which: column 1 is a row label column 2 and 3 are values I would like to do a simple operation on this table and get the... (8 Replies)
Discussion started by: ksennin
8 Replies

3. Shell Programming and Scripting

Print smallest integer from file using awk custom function?

`awk` function looks like this in a file name `fun.awk`: { print small() } function small() { a=$0 smal=0 for(i=1;i<=3;i++) { if( a<a) smal=a else (4 Replies)
Discussion started by: lazerz
4 Replies

4. UNIX for Dummies Questions & Answers

Print result of mv -n

I am trying to move files which donot have same filename using find /Users/ParijatMac/desktop/unix/new_dir -type f -mmin +"$HRS" -exec mv -n "{}" /Users/ParijatMac/desktop/unix/old_dir \; -print but i am getting all filenames including the ones with duplicate names.Please help me to sort... (5 Replies)
Discussion started by: parijat guh
5 Replies

5. Shell Programming and Scripting

Print if found non-desired result

I have a result like this root@server # grep -rl maldet /etc/cron* /etc/cron.d/maldet_daily /etc/cron.d/malcron /etc/cron.d/malcrondaily /etc/cron.d/malcronweekly What I need is, I need an if/else condition such that, if there is any output other than /etc/cron.d/maldet_daily in the... (8 Replies)
Discussion started by: anil510
8 Replies

6. Shell Programming and Scripting

Use the print result of a script as an argument

Hi all, Say I have a script named script.sh. What it does is to print a line like "abc" #! /usr/bin/ksh print "abc" I would like to pass this value to an external variable, var1="script.sh" However when I echo $var1 I got "script.sh" itself instead of the result? Thanks (3 Replies)
Discussion started by: isaacniu
3 Replies

7. Shell Programming and Scripting

A function in shell script,how can i get the right result

there is a directory /data/users/osa/psidp/dmp/files/cimdir ,it have some subdirectories ,and also the subdirectoriy have it's subdirectoriis. I want to get all the leaf nodes of the directory path . but the result of the script is wrong ,how can i get the right result somebody who can help me... (3 Replies)
Discussion started by: fw0037
3 Replies

8. Shell Programming and Scripting

a function in shell script,how can i get the right result

there is a directory /data/users/osa/psidp/dmp/files/cimdir ,it have some subdirectories ,and also the subdirectoriy have it's subdirectoriis. I want to get all the leaf nodes of the directory path . but the result of the script is wrong ,how can i get the right result somebody who can... (1 Reply)
Discussion started by: fw0037
1 Replies

9. Homework & Coursework Questions

A function in shell script,how can i get the right result

there is a directory /data/users/osa/psidp/dmp/files/cimdir ,it have some subdirectories ,and also the subdirectoriy have it's subdirectoriis. I want to get all the leaf nodes of the directory path . but the result of the script is wrong ,how can i get the right result somebody who can help... (1 Reply)
Discussion started by: fw0037
1 Replies

10. Shell Programming and Scripting

print out result from data file

i got a data file which contains all the pid,ppid,user,command,pcpu,start_time,status. I wanted to display out the pcpu which is greater than 0. i uses awk'{if($5 > 0){print}}' filename.txt but is printing out result which not i wanted. Is there any way which i can print out those pcpu which is... (8 Replies)
Discussion started by: thms_sum
8 Replies
Login or Register to Ask a Question
IWGETID(8)						     Linux Programmer's Manual							IWGETID(8)

NAME
iwgetid - Report ESSID, NWID or AP/Cell Address of wireless network SYNOPSIS
iwgetid [interface] [--raw] [--scheme] [--ap] [--freq] [--mode] [--protocol] [--channel] DESCRIPTION
iwgetid is used to find out the NWID, ESSID or AP/Cell Address of the wireless network that is currently used. The information reported is the same as the one shown by iwconfig, but iwgetid is easier to integrate in various scripts. By default, iwgetid will print the ESSID of the device, and if the device doesn't have any ESSID it will print its NWID. The default formatting output is pretty-print. OPTIONS
--raw This option disables pretty-printing of the information. This option is orthogonal to the other options (except --scheme), so with the appropriate combination of options you can print the raw ESSID, AP Address or Mode. This format is ideal when storing the result of iwgetid as a variable in Shell or Perl scripts or to pass the result as an argument on the command line of iwconfig. --scheme This option is similar to the previous one, it disables pretty-printing of the information and removes all characters that are not alphanumerics (like space, punctuation and control characters). The resulting output is a valid Pcmcia scheme identifier (that may be used as an argument of the command cardctl scheme). This for- mat is also ideal when using the result of iwgetid as a selector in Shell or Perl scripts, or as a file name. --ap Display the MAC address of the Wireless Access Point or the Cell. --freq Display the current frequency or channel used by the interface. --channel Display the current channel used by the interface. The channel is determined using the current frequency and the frequency list pro- vided by the interface. --mode Display the current mode of the interface. --protocol Display the protocol name of the interface. This allows to identify all the cards that are compatible with each other and accept the same type of configuration. This can also be used to check Wireless Extension support on the interface, as this is the only attribute that all drivers support- ing Wireless Extension are mandated to support. SEE ALSO
iwconfig(8), ifconfig(8), iwspy(8), iwpriv(8). wireless-tools 02 December 2003 IWGETID(8)