10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I will appreciate if you help me here in this script in Solaris Enviroment.
Scenario:
i have 2 files :
1) /tmp/TRANSACTIONS_DAILY_20180730.txt:
201807300000000004
201807300000000005
201807300000000006
201807300000000007
201807300000000008
2)... (10 Replies)
Discussion started by: teokon90
10 Replies
2. Shell Programming and Scripting
I have an xml file dumped from rrd file, that I want to "patch" so the xml file doesn't contain any blank hole in the resulting graph of the rrd file.
Here is the file.
<!-- 2015-10-12 14:00:00 WIB / 1444633200 --> <row><v> 4.0419731265e+07 </v><v> 4.5045912770e+06... (2 Replies)
Discussion started by: rk4k
2 Replies
3. Shell Programming and Scripting
Hi
This is my first post and I'm just a beginner. So please be nice to me.
I have a couple of html files where a pattern beginning with "http://www.site.com" and ending with "/resource.dat" is present on every 241st line. How do I extract this to a new text file?
I have tried sed -n 241,241p... (13 Replies)
Discussion started by: dejavo
13 Replies
4. Solaris
Hi,
Anyone can help me in Solaris command on how to insert a file at specific line.
I want file1.sql content to be inserted on file2.sh after "recover database using backup controlfile until cancel".
# file1.sql
/archivelogs/927_822338133.arc
/archivelogs/671_822338107.arc... (3 Replies)
Discussion started by: fspalero
3 Replies
5. Shell Programming and Scripting
I have list of files in a directory 'dir'. Each file is of type HTML. I need to read each file and get the string which starts with 'http' and write them in a new text file. How can i do this shell scripting?
file1.html
<head>
<url>http://www.google.com</url>
</head>
file2.html
<head>... (6 Replies)
Discussion started by: vel4ever
6 Replies
6. Shell Programming and Scripting
Say the input was as follows:
Brat 20 x 1000 32rf
Pour 15 p 1621 05pr
Dart 10 z 1111 22xx
My program prompts for an input, what I want is to use the input to locate a specific field. Like if I type in, "Pou" then it would return "Pour" and just "Pour"
I currently have this line but it is... (6 Replies)
Discussion started by: Bungkai
6 Replies
7. UNIX for Dummies Questions & Answers
Hi All,
I am having 100 lines a text file say a.txt. I want read the 'nth' line from that file inside a script. Kindly tell us how to that. (2 Replies)
Discussion started by: boopathyvasagam
2 Replies
8. UNIX for Dummies Questions & Answers
Hi everyone,
I am attempting to do something that should be very simple. How do I replace a specific line of a file with different text, and then save that file to its original name? I believe I want to use the sed command with the c option, but I after trying many times, I can't get the right... (10 Replies)
Discussion started by: msb65
10 Replies
9. Shell Programming and Scripting
Hi,
how can we search for a word (with case ignore )on specific line numbers
ex:
Awk /^regEX/ with condition on first line or second line
Awk/^ regex1/ on line 1
Awk /^regEX2/ on line 3
thanks in advance (4 Replies)
Discussion started by: rider29
4 Replies
10. Shell Programming and Scripting
Hi all...
I not a expert unix script programmer, Kindly adjust.
My requirement is that, i have a file which contains the about 10 lines -
say
1
2
3
...
8 war of the worlds: => text in this line
9 9000,80,78,77,334,445 => this line contains some numbers separted by commas
10
... (10 Replies)
Discussion started by: cool_boss2121
10 Replies
runat(1) User Commands runat(1)
NAME
runat - execute command in extended attribute name space
SYNOPSIS
/usr/bin/runat file [command]
DESCRIPTION
The runat utility is used to execute shell commands in a file's hidden attribute directory. Effectively, this utility changes the current
working directory to be the hidden attribute directory associated with the file argument and then executes the specified command in the
bourne shell (/bin/sh). If no command argument is provided, an interactive shell is spawned. The environment variable $SHELL defines the
shell to be spawned. If this variable is undefined, the default shell, /bin/sh, is used.
The file argument can be any file, including a directory, that can support extended attributes. It is not necessary that this file have any
attributes, or be prepared in any way, before invoking the runat command.
OPERANDS
The following operands are supported:
file Any file, including a directory, that can support extended attributes.
command The command to be executed in an attribute directory.
ERRORS
A non-zero exit status will be returned if runat cannot access the file argument, or the file argument does not support extended
attributes.
USAGE
See fsattr(5) for a detailed description of extended file attributes.
The process context created by the runat command has its current working directory set to the hidden directory containing the file's
extended attributes. The parent of this directory (the ".." entry) always refers to the file provided on the command line. As such, it may
not be a directory. Therefore, commands (such as pwd) that depend upon the parent entry being well-formed (that is, referring to a direc-
tory) may fail.
In the absence of the command argument, runat will spawn a new interactive shell with its current working directory set to be the provided
file's hidden attribute directory. Notice that some shells (such as zsh and tcsh) are not well behaved when the directory parent is not a
directory, as described above. These shells should not be used with runat.
EXAMPLES
Example 1: Using runat to list extended attributes on a file
example% runat file.1 ls -l
example% runat file.1 ls
Example 2: Creating extended attributes
example% runat file.2 cp /tmp/attrdata attr.1
example% runat file.2 cat /tmp/attrdata > attr.1
Example 3: Copying an attribute from one file to another
example% runat file.2 cat attr.1 | runat file.1 "cat > attr.1"
Example 4: Using runat to spawn an interactive shell
example% runat file.3 /bin/sh
This spawns a new shell in the attribute directory for file.3. Notice that the shell will not be able to determine what your current direc-
tory is. To leave the attribute directory, either exit the spawned shell or change directory (cd) using an absolute path.
Recommended methods for performing basic attribute operations:
display
runat file ls [options]
read
runat file cat attribute
create/modify
runat file cp absolute-file-path attribute
delete
runat file rm attribute
permission changes
runat file chmod mode attribute
runat file chgrp group attribute
runat file chown owner attribute
interactive shell
runat file /bin/sh
or set your $SHELL to /bin/sh and
runat file
The above list includes commands that are known to work with runat. While many other commands may work, there is no guarantee that any
beyond this list will work. Any command that relies on being able to determine its current working directory is likely to fail. Examples of
such commands follow:
Example 5: Using man in an attribute directory
example% runat file.1 man runat
getcwd: Not a directory
Example 6: Spawning a tcsh shell in an attribute directory
example% runat file.3 /usr/bin/tcsh
tcsh: Not a directory
tcsh: Trying to start from "/home/user"
A new tcsh shell has been spawned with the current working directory set to the user's home directory.
Example 7: Spawning a zsh shell in an attribute directory
example% runat file.3 /usr/bin/zsh
example%
While the command appears to have worked, zsh has actually just changed the current working directory to '/'. This can be seen by using
/bin/pwd:
example% /bin/pwd
/
ENVIRONMENT VARIABLES
SHELL Specifies the command shell to be invoked by runat.
EXIT STATUS
The following exit values are returned:
125 The attribute directory of the file referenced by the file argument cannot be accessed.
126 The exec of the provided command argument failed.
Otherwise, the exit status returned is the exit status of the shell invoked to execute the provided command.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
|CSI |Enabled |
+-----------------------------+-----------------------------+
|Interface Stability |Evolving |
+-----------------------------+-----------------------------+
SEE ALSO
open(2), attributes(5), fsattr(5)
NOTES
It is not always obvious why a command fails in runat when it is unable to determine the current working directory. The errors resulting
can be confusing and ambiguous (see the tcsh and zsh examples above).
SunOS 5.10 22 Jun 2001 runat(1)