10-21-2009
taking a part of string from a given path
Hi
I have two path as follows
system/console/bin/code/sample/testfile.txt
system/console/bin/database/files/new/dbfile.txt
I need the output as
code/sample in first case
database/files/new in second case
That is I am omitting system/console/bin and the filename(s) in both the cases
Can you please help
Thanks in advance
Suresh
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Seems I'm inundating this forum with questions, but anyway:
I am writing a script that should accept one and only one argument when called.
That argument should designate a file, either with path/filename or just filename.
Now to the difficult bit:
I want to figure out a way to store... (9 Replies)
Discussion started by: ropers
9 Replies
2. Shell Programming and Scripting
I need a script to be able to take a path such as "/foo/bar/thing" a put the "/foo/bar/" bit in one variable and the "thing" bit in another.
I figured awk would probably be the best tool for the job but looking at the man page didn't seem to help. The only way i know how to use awk is with... (12 Replies)
Discussion started by: Nat
12 Replies
3. UNIX for Dummies Questions & Answers
so here is my path:
/usr/bin:/bin:/usr/sbin:/sbin:/Users/a:/usr/local/bin:/usr/X11/bin
how would I remove only the "a" or name string within it?
any help appreciated (7 Replies)
Discussion started by: cleansing_flame
7 Replies
4. Shell Programming and Scripting
hi
i have a file with name "CT_Thread_Trace.384.20080728-121217.log"
i need 384 , can any one help
thanks
Satya (5 Replies)
Discussion started by: Satyak
5 Replies
5. Shell Programming and Scripting
Hi
I am trying to use sed to retrieve part of my html file's path. I am having a hard time getting what I want. Could someone give me some help?
I want to retrieve the section after html and before the file name
For example if I have the following, ... (3 Replies)
Discussion started by: tiger66
3 Replies
6. Shell Programming and Scripting
Hi all,
I am learning the use of regular expression and I would like to know which regex can be used to select only the last part of a directory path name.
Something like:
/dir1/dir2/dir2
and I want to select the last /dir2 where dir2 can be any kind of string.
Thanks a lot for your help.... (7 Replies)
Discussion started by: elric
7 Replies
7. UNIX for Advanced & Expert Users
Let say I have /home/user1/bin/ and i want it to be /root/bin
I tried : s/\/home\/user1/user2/
but it can't find the pattern user1.
I tried: s/*\/home\/user1*/user2/
as well same result
many thanks (4 Replies)
Discussion started by: c00lsnoopy
4 Replies
8. Shell Programming and Scripting
Not sure how to do the following, but any help would be appreciated.
Has to be done using C shell (sorry about that).
I have about 300 files that I need this done for, but I am only going to give one example. I will just need to know how to execute your solution through some type of loop to... (2 Replies)
Discussion started by: jclanc8
2 Replies
9. UNIX for Advanced & Expert Users
Hi,
So I struggled to find a solution to the following problem:
I want to make sed print only part of multiple different paths.
So lets say we have
/path/path1/path2/logs/bla/blabla
/path/path1/path2/path3/logs/yadda/yadda/yadda
Can someone suggest a way to make sed or other... (5 Replies)
Discussion started by: dampio
5 Replies
10. Shell Programming and Scripting
Hi All,
My Problem is like below.
I have a file which contains just one row and contains data like
PO_CREATE12457888888888889SK1234567878744551111111111SK89456321145789955455555SK8888888815788852222
i want to extract SK12345678
SK89456321
SK88888888
So basically SK and next 8... (4 Replies)
Discussion started by: Asfakul Islam
4 Replies
LEARN ABOUT MOJAVE
systemd-getty-generator
SYSTEMD-GETTY-GENERATOR(8) systemd-getty-generator SYSTEMD-GETTY-GENERATOR(8)
NAME
systemd-getty-generator - Generator for enabling getty instances on the console
SYNOPSIS
/lib/systemd/system-generators/systemd-getty-generator
DESCRIPTION
systemd-getty-generator is a generator that automatically instantiates serial-getty@.service on the kernel console(s), if they can function
as ttys and are not provided by the virtual console subsystem. It will also instantiate serial-getty@.service instances for virtualizer
consoles, if execution in a virtualized environment is detected. If execution in a container environment is detected, it will instead
enable console-getty.service for /dev/console, and container-getty@.service instances for additional container pseudo TTYs as requested by
the container manager (see Container Interface[1]). This should ensure that the user is shown a login prompt at the right place, regardless
of which environment the system is started in. For example, it is sufficient to redirect the kernel console with a kernel command line
argument such as console= to get both kernel messages and a getty prompt on a serial TTY. See kernel-parameters.txt[2] for more information
on the console= kernel parameter.
systemd-getty-generator implements systemd.generator(7).
Further information about configuration of gettys can be found in systemd for Administrators, Part XVI: Gettys on Serial Consoles (and
Elsewhere)[3].
SEE ALSO
systemd(1), agetty(8)
NOTES
1. Container
Interface
https://www.freedesktop.org/wiki/Software/systemd/ContainerInterface/
2. kernel-parameters.txt
https://www.kernel.org/doc/Documentation/admin-guide/kernel-parameters.txt
3. systemd for Administrators, Part XVI: Gettys on Serial Consoles (and Elsewhere)
http://0pointer.de/blog/projects/serial-console.html
systemd 237 SYSTEMD-GETTY-GENERATOR(8)