Sponsored Content
Top Forums UNIX for Dummies Questions & Answers extract a part of a path like (input: /etc/exp/home/bin ====> output: exp) Post 302268601 by yeclota on Tuesday 16th of December 2008 03:00:47 AM
Old 12-16-2008
extract a part of a path like (input: /etc/exp/home/bin ====> output: exp)

Hi,
thanks for you help,
with this solution:
echo '/etc/exp/home/bin' | awk -F/ '{print $3}'
exp.

do you have another solution with sed command? because when a try your first solution in a shell script having 3 input parmeters, the {print $3} take another value.

now i'm looking for a sed command, if this command can solve the problem.

Thanks
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

reg exp question

Hi, Should be a difference between ']]*' and ']+' ? I use them in bash with sed and grep. Thanks (1 Reply)
Discussion started by: ynir
1 Replies

2. Shell Programming and Scripting

reg exp for sed

$ cat file.txt asd <AA>dev <LL>def <RR>sha This works for me: $ sed -r 's/^ .*<LL>def/\t<LL>my/' file.txt asd <AA>dev <LL>my <RR>sha But, this does not work for me: $ sed -r 's/^\s+<LL>def/\t<LL>my/' file.txt asd ... (1 Reply)
Discussion started by: demoprog
1 Replies

3. Shell Programming and Scripting

Perl reg exp

Hi, I am using the following piece of code for extracting some data from in between some tags ... $text =~ /<TAG1>(.*)<\/TAG1>.*<TAG2>(.*)<\/TAG2>.*<TAG3>(.*)<\/TAG4>.*<TAG5>(.*)<\/TAG5>/; $tag1=$1; print "\n$tag1"; But I am getting an error like Use of uninitialized value in... (1 Reply)
Discussion started by: King Nothing
1 Replies

4. UNIX for Dummies Questions & Answers

exp command to extract particular rows

Hi, I'm new to unix so hopefully you can help! I'm using the below command to extract a tables contents and store it in a dmp file: exp OWNER/OWNER@LINK FILE=exp.dat TABLES=TABLE_TEST This works fine and dumps the table into the exp.dat file. What i can't figure out, is how to... (3 Replies)
Discussion started by: boijie
3 Replies

5. Shell Programming and Scripting

Regular exp in awk

Hi all, One small doubt, reg exp in awk, is it possible to extract the match of regular expression like in perl? eg: B R16288 Map3_NoCat B R16067 Map4_NoCat B R16647 Map3_NoCat B R16450 Map3_NoCat B R16106 Map6_NoCat B R16000 Map3_NoCat B R16395 Map3_NoCat B R16243 Map3_NoCat B R16023... (6 Replies)
Discussion started by: gvj
6 Replies

6. Shell Programming and Scripting

cp -p /home/* home/exp/*.date not working please help

:( ---------- Post updated at 01:51 AM ---------- Previous update was at 01:50 AM ---------- Not working ---------- Post updated at 02:04 AM ---------- Previous update was at 01:51 AM ---------- cp -p /home/* home/exp/*.`date` i am using this (4 Replies)
Discussion started by: rishiraaz
4 Replies

7. Shell Programming and Scripting

set output of linux cmd as a variable in .exp

I am trying to make a script to take commands from a .txt file ( line by line) and pass it using send ( used in another function ) what i am trying to achieve is : set nol "`grep '' ${exp_path2}/cmdlist.txt | wc -l `" as in shell script nol=`grep '' $exp_path2/cmdlist.txt | wc -l` ... (0 Replies)
Discussion started by: dixyantar
0 Replies

8. Emergency UNIX and Linux Support

Need Help On REG EXP in unix

Respected All, I have a very big xml in that i want to search only below 3 lines. <target name ="UpgradePrimaryBox" depends ="configureBox1"> <echo> Finished Upgrading Primary Box </echo> </target> grep -i "<target.*UpgradePrimaryBox" this gives me the first line. then i need to match... (7 Replies)
Discussion started by: ameyrk
7 Replies
FREXP(3P)						     POSIX Programmer's Manual							 FREXP(3P)

PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the correspond- ing Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. NAME
frexp, frexpf, frexpl - extract mantissa and exponent from a double precision number SYNOPSIS
#include <math.h> double frexp(double num, int *exp); float frexpf(float num, int *exp); long double frexpl(long double num, int *exp); DESCRIPTION
These functions shall break a floating-point number num into a normalized fraction and an integral power of 2. The integer exponent shall be stored in the int object pointed to by exp. RETURN VALUE
For finite arguments, these functions shall return the value x, such that x has a magnitude in the interval [0.5,1) or 0, and num equals x times 2 raised to the power *exp. If num is NaN, a NaN shall be returned, and the value of *exp is unspecified. If num is +-0, +-0 shall be returned, and the value of *exp shall be 0. If num is +-Inf, num shall be returned, and the value of *exp is unspecified. ERRORS
No errors are defined. The following sections are informative. EXAMPLES
None. APPLICATION USAGE
None. RATIONALE
None. FUTURE DIRECTIONS
None. SEE ALSO
isnan(), ldexp(), modf(), the Base Definitions volume of IEEE Std 1003.1-2001, <math.h> COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html . IEEE
/The Open Group 2003 FREXP(3P)
All times are GMT -4. The time now is 01:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy