07-14-2010
Read from file specific place in file using inode
Hello, I am using tcsh on AIX.
I would like to write a script that does the following:
1. given an inode, how do I find exactly the name of the file?
I know I could do this using ls -i | grep <inode>
but it returns: <inode> <filename>. I need some string manipulation or something to retrieve just the file name.
I tried using variables, but I think variables are defined differently in tsch or something.
2. So, 2 - how to define variables on tcsh (that is personal variables [not env]).
3. How to retrieve number of lines written during a command?
That is, say I activated command1 and it wrote about 200 lines - can I get the number of lines it wrote?
Thank you very much for your help!
10 More Discussions You Might Find Interesting
1. Programming
Please Help me
I have a Bulk file containing Hex data
I want to read specific lines from that bulk file by ID number.
example
ID DATE Time data
14 2005/09/28 07:40:08.546 0 5 078B1C 01916C 0FE59C 004B54 0A9670 0D04ED 05B6B4 0E2223... (10 Replies)
Discussion started by: rajan_ka1
10 Replies
2. Shell Programming and Scripting
Hello,
I need to search in file2 for
class A : public B
{
and insert right after that the content of file1.
I am a bit lost as to which tools (which bash functions, awk...). I should use. Thanks for some directions here.
Regards (1 Reply)
Discussion started by: JCR
1 Replies
3. Shell Programming and Scripting
I have a file that I want to split in 2 (with Bourne shell sh) preferably. The file consists of groups of lines separated by newline. The file can vary in length, so I need to check number of groups of text. Here's an example
====EXAMPLE START====
#fruit banana
#color yellow
#surface smooth... (0 Replies)
Discussion started by: borgeh
0 Replies
4. Shell Programming and Scripting
If I cat a file
And want to go to the first instance of a particular value - what command would I use?
And then from that point where I jumped to search for another value - but only search from that point forward not before the file?
Thanks~ (2 Replies)
Discussion started by: llsmr777
2 Replies
5. Shell Programming and Scripting
Hi All,
I want to read one number from the file.
Only one number will be there in the file.
then i have to increment the number in my script and put it back in the same file.
Is it possible?
Can anybody help me?
Thanks,
Vinay (6 Replies)
Discussion started by: vinayakatj56
6 Replies
6. Shell Programming and Scripting
I use zentyal for my server admin, which is great but zentyal auto-generates config file on boot and hence overwrites any changes made directly to config files. In order to allow multiple user access to a MS ACCESS database, I need to customise the smb.conf file and add the following line to the... (9 Replies)
Discussion started by: barrydocks
9 Replies
7. Shell Programming and Scripting
Hi,
This is most likely a dumb question but I could not find answer to it elsewhere.
I'm building a simple menu with case /esac and want to read user's input:
Please enter XYZ ; read XYZ
How do I take the value of XYZ and insert it as a variable $XYZ in file file.txt ?
I may need to... (9 Replies)
Discussion started by: svetoslav_sj
9 Replies
8. 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
9. Shell Programming and Scripting
Hello,
I'm trying to create multiple commands using a variable input from another file but am not getting any successful results.
Basically, file1.txt contains multiple lines with single words:
<file1.txt>
yellow
blue
black
white
I want to create multiple echo commands with these... (8 Replies)
Discussion started by: demmel
8 Replies
10. Shell Programming and Scripting
I am trying to use awk to place the contens of a filename in $1 and $2 followed by the data in the text file. Basically, put the filename within the text file. There are over 1000 files in the directory and as of now each file is saved with a unique name but it is not within the file. Thank you... (10 Replies)
Discussion started by: cmccabe
10 Replies
LEARN ABOUT CENTOS
matchpathcon_checkmatches
matchpathcon_checkmatches(3) SELinux API documentation matchpathcon_checkmatches(3)
NAME
matchpathcon_checkmatches, matchpathcon_filespec_add, matchpathcon_filespec_destroy, matchpathcon_filespec_eval - check and report whether
any specification index has no matches with any inode. Maintenance and statistics on inode associations
SYNOPSIS
#include <selinux/selinux.h>
void matchpathcon_checkmatches(char *str);
int matchpathcon_filespec_add(ino_t ino, int specind, const char *file);
void matchpathcon_filespec_destroy(void);
void matchpathcon_filespec_eval(void);
DESCRIPTION
matchpathcon_checkmatches() checks whether any specification has no matches and reports them. The str argument is used as a prefix for any
warning messages.
matchpathcon_filespec_add() maintains an association between an inode ino and a specification index specind, and checks whether a conflict-
ing specification is already associated with the same inode (e.g. due to multiple hard links). If so, then it uses the latter of the two
specifications based on their order in the file context configuration. Returns the specification index used or -1 on error.
matchpathcon_filespec_destroy() destroys any inode associations that have been added, e.g. to restart for a new filesystem.
matchpathcon_filespec_eval() displays statistics on the hash table usage for the inode associations.
RETURN VALUE
Returns zero on success or -1 otherwise.
SEE ALSO
selinux(8), matchpathcon(3), matchpathcon_index(3), freecon(3), setfilecon(3), setfscreatecon(3)
sds@tycho.nsa.gov 21 November 2009 matchpathcon_checkmatches(3)