My file creates an output log after which includes a few sql queries.
I segregate them into warnings and errors and then get a total count.
The errors' and warnings' lines always start with SQL{4} followed by the details of the error.
This is what im doing as o now...
errors=`grep -A 1 -E... (11 Replies)
Hi All,
Please tell me how can I Find a string using grep & print the line above or below that in solaris?
Please share as I am unable to use grep -A or grep -B as it is not working on Solaris. (10 Replies)
Hi all ,
I'm new to unix
I have a checked project , there exists a file called xxx.config .
now my task is to find all the files in the checked out project which references to this xxx.config file.
how do i use grep or find command . (2 Replies)
After I create printer queues in AIX, I have to append a filter file location within that printers custom file. within lets say test_queue.txt I need to find the row that starts with :699 and then I need to append on the end the string /usr/local/bin/k_portrait.sh.
Now I've gotten the sed... (2 Replies)
Hello people!
I would like to create one script following this stage
I have one directory with 100 files
File001
File002
...
File100
(This is the format of content of the 100 files)
2012/03/10 12:56:50:221875936 1292800448912 12345 0x00 0x04 0
then I have one... (0 Replies)
Hi All,
I am reading the host file by ignoring the comments and write it to the other file. I am reading with regular expression for IP address.
grep -E '^{1,3}\.{1,3}\.{1,3}\.{1,3}' $inputFile | awk '{for(i=2;i<=NF;i++)print $1,$i}' > $DR_HOME/OS/temp
After that am reading each host... (4 Replies)
Hi,
I want to read a file line by line and exclude the lines that are beginning with special characters. The below code is working fine except when the line starts with hyphen (-) in the file.
for TEST in `cat $FILE | grep -E -v '#|/+' | awk '{FS=":"}NF > 0{print $1}'`
do
.
.
done
How... (4 Replies)
Need to add a numeric & special char to end of the first line
Existing file:
12-11-16|11 2016 Jan 12:34:55|03:55|
13-10-16|10 2016 Jan 12:34:55|03:55|12-11-16|11 2016 Jan 12:34:55|03:55|
14-10-16|19 2016 Jan 12:34:55|03:55|13-11-16|11 2016 Jan 12:34:55|04:55|
15-10-16|18 2016 Jan... (11 Replies)
Hi,
i need to cat a file after # till the end of the file
usually ill do cat /etc/somthing | grep -A999999 #
but its not that professional
thanks
edit by bakunin: please use CODE-tags (or ICODE-tags) for code and data. Thank you. (9 Replies)
Hello,
I have some code that works more or less. This is called by a make file to adjust some hard-coded definitions in the src code. The script generated some values by looking at some of the src files and then writes those values to specific locations in other files. The awk code is used to... (3 Replies)
Discussion started by: LMHmedchem
3 Replies
LEARN ABOUT FREEBSD
dirname
BASENAME(1) BSD General Commands Manual BASENAME(1)NAME
basename, dirname -- return filename or directory portion of pathname
SYNOPSIS
basename string [suffix]
basename [-a] [-s suffix] string [...]
dirname string [...]
DESCRIPTION
The basename utility deletes any prefix ending with the last slash '/' character present in string (after first stripping trailing slashes),
and a suffix, if given. The suffix is not stripped if it is identical to the remaining characters in string. The resulting filename is
written to the standard output. A non-existent suffix is ignored. If -a is specified, then every argument is treated as a string as if
basename were invoked with just one argument. If -s is specified, then the suffix is taken as its argument, and all other arguments are
treated as a string.
The dirname utility deletes the filename portion, beginning with the last slash '/' character to the end of string (after first stripping
trailing slashes), and writes the result to the standard output.
EXIT STATUS
The basename and dirname utilities exit 0 on success, and >0 if an error occurs.
EXAMPLES
The following line sets the shell variable FOO to /usr/bin.
FOO=`dirname /usr/bin/trail`
SEE ALSO csh(1), sh(1), basename(3), dirname(3)STANDARDS
The basename and dirname utilities are expected to be IEEE Std 1003.2 (``POSIX.2'') compatible.
BSD April 18, 1994 BSD