Sponsored Content
Top Forums UNIX for Dummies Questions & Answers having issues in using Cut Command Post 302466734 by paoie on Wednesday 27th of October 2010 07:45:52 AM
Old 10-27-2010
Power having issues in using Cut Command

Hi,

I would like to ask for your help with my problem,

im writing a unix script to remove characters before the symbol "/", but the one being removed are characters after the symbol. Ive searched over the internet and found no answer.. hope you can help me with this.

sample:
text file, temp.log contains:
Code:
file-sam-wizs/296596.pdf
file-sam-wizs/0307444.pdf
file-sam-001/362261.pdf
file-sam-001/362265.pdf
file-sam-001/362268.pdf
file-sam-001/362270.pdf
file-sam-001/362272.pdf
file-sam-001/362273.pdf
file-sam-3/362275.pdf
file-sam-3/362276.pdf
file-sam-3/362278.pdf
file-sam-3/362280.pdf
file-sam-003/362281.pdf
file-sam-3/362283.pdf
file-sam-4/362285.pdf
file-sam-004/362289.pdf
file-sam-004/362311.pdf
file-sam-004/362352.pdf
file-sam-4/362353.pdf
file-sam-4/362354.pdf
file-sam-002/362241.pdf
file-sam-002/362247.pdf
file-sam-002/362251.pdf
file-sam-002/362252.pdf
file-sam-002/362254.pdf
file-sam-002/362258.pdf

when i run the following command:

Code:
cut -d'/' -f 1,1 temp_file.log

This is the result,
Code:
file-sam-wizs
file-sam-wizs
file-sam-001
file-sam-001
file-sam-001
file-sam-001
file-sam-001
file-sam-001
file-sam-3
file-sam-3
file-sam-3
file-sam-3
file-sam-003
file-sam-3
file-sam-4
file-sam-004
file-sam-004

where the expected output should be:
Code:
 
296596.pdf
0307444.pdf
362261.pdf
362265.pdf
362268.pdf
362270.pdf
362272.pdf
362273.pdf
362275.pdf
362276.pdf
362278.pdf
362280.pdf
362281.pdf
362283.pdf
362285.pdf
362289.pdf
362311.pdf
362352.pdf
362353.pdf
362354.pdf
362241.pdf
362247.pdf
362251.pdf
362252.pdf
362254.pdf

Even if i change the value of -f 1,1 it has no effect. I would really appreciate your help guys..
thank you very much.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Issues with cut

We are running on a Sun cluster using ksh. We have a script that has been running for about six months with no issues. The script has not been modified and our results are now coming out diffrent. <BEGIN> cat $exfile | while read line do ... (1 Reply)
Discussion started by: bthomas
1 Replies

2. Shell Programming and Scripting

kill command issues

xxxxxx (8 Replies)
Discussion started by: kitty123
8 Replies

3. UNIX for Dummies Questions & Answers

Issues I'm having with the Find Command

:confused: I've been trying to display all my files in my /tmp directory when I'm in it. I just can't get the darn find command working... And I've been trying to look at my /tmp directory on my home directory and I know I'm messing something up there.. Another issue I had while back but... (12 Replies)
Discussion started by: curtner
12 Replies

4. UNIX for Dummies Questions & Answers

mget command issues

Hi I am trying to get 3 files sitting on a FTP server to an application server. All 3 files are .csv files. I am using mget *.csv and it transfers only 2 files. the 3 files contain a common word in their file names "Report". I tried mget *Report*.csv and that gets me 2 files as well. ... (3 Replies)
Discussion started by: bobsn
3 Replies

5. Shell Programming and Scripting

Cut Command error cut: Bad range

Hi Can anyone what I am doing wrong while using cut command. for f in *.log do logfilename=$f Log "Log file Name: $logfilename" logfile1=`basename $logfilename .log` flength=${#logfile1} Log "file length $flength" from_length=$(($flength - 15)) Log "from... (2 Replies)
Discussion started by: dgmm
2 Replies

6. Homework & Coursework Questions

sed & cut command issues

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: After using the egrep command to pull certain lines from the asg5f1 (creating the asg5f1c file), I am required... (1 Reply)
Discussion started by: robrom78
1 Replies

7. UNIX for Dummies Questions & Answers

Cut pid from ps using cut command

hay i am trying to get JUST the PID from the ps command. my command line is: ps -ef | grep "mintty" | cut -d' ' -f2 but i get an empty line. i assume that the delimiter is not just one space character, but can't figure out what should i do in order to do that. i know i can use awk or cut... (8 Replies)
Discussion started by: ran ber
8 Replies

8. Shell Programming and Scripting

Issues in sed command

I use SMP Tue Aug 18 15:51:48 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux We have a user-defined command called "submit" which will open a vi terminal in which we need to enter the description at 24th line and save it. In order to simplify this, i decided to create another command in which the... (3 Replies)
Discussion started by: pandeesh
3 Replies

9. UNIX for Beginners Questions & Answers

Cut command: can't make it cut fields

I'm a complete beginner in UNIX (and not a computer science student either), just undergoing a tutoring course. Trying to replicate the instructions on my own I directed output of the ls listing command (lists all files of my home directory ) to My_dir.tsv file (see the screenshot) to make use of... (9 Replies)
Discussion started by: scrutinizerix
9 Replies

10. Shell Programming and Scripting

Cut command on RHEL 6.8 compatibility issues

We have a lot of scripts using cut as : cut -c 0-8 --works for cut (GNU coreutils) 5.97, but does not work for cut (GNU coreutils) 8.4. Gives error - cut: fields and positions are numbered from 1 Try `cut --help' for more information. The position needs to start with 1 for later... (6 Replies)
Discussion started by: Vikram Jain
6 Replies
getksym(2)							System Calls Manual							getksym(2)

NAME
getksym() - get information for local and global kernel symbols SYNOPSIS
#include <sys/types.h> #include <sys/ksym.h> #include <elf.h> #include <elf_parisc.h> /* For STT_PARISC_MILLI on PA-RISC */ int getksym(char * symname, char * modname, uint64_t *value, uint64_t *info); DESCRIPTION
There are two ways that can be used to retrieve kernel symbol information. As detailed below, if symname is provided and value is set to zero, attempts to retrieve the value of the symbol; if a non-zero value is provided, the associated symbol name is retrieved. given a symname, looks for global or and local symbols of that name in the symbol table of the static kernel and all currently loaded ker- nel modules. If it finds a match, returns the value associated with that symbol (typically its address) in the space pointed to by value, and the type of that symbol in the space pointed to by info. NOTE: If there are two symbols (a local and a global symbol) with the same name, returns the first symbol that it finds with that name, which will be the local symbol. The types returned are: unknown type text symbol (typically function) PA-RISC millicode function (PA-RISC only) data symbol section symbol The symbol name can be no more than characters. If modname is set to the name (basename only) of a dynamically loaded module, then the search for the symbol name will only be in that module. If modname is NULL, then the search order for the symbol name will be the static kernel followed by each of the currently loaded modules in the order in which they were loaded. The module name can be no more than char- acters. If both a non-zero value and a symname are provided, the behavior of is undefined. If a zero value and an empty or NULL symname is pro- vided, the behavior of is undefined. If is given a valid non-zero address in the statically configured kernel or one of the currently loaded modules in the space pointed to by value, it will return, in the space pointed to by symname, the name of the symbol whose value is the closest one less than or equal to the given value and, in space pointed to by info, the difference between the address given and the value of the symbol found. NOTE: If two symbols (an symbol and an symbol) have the same address, returns the symbol. The space pointed to by symname must be at least characters long. RETURN VALUE
returns upon successful completion. If an error occurs, a value of is returned and is set to indicate the error. ERRORS
fails if one or more of the following are true: modname does not represent a currently loaded module. modname is greater than MODMAXNAMELEN characters long, or symname is greater than MAXSYMNMLEN characters long. The symbol name given is not found, or the value given is not a currently valid address. EXAMPLES
The following code sequence and call to obtains a symbol name (and an offset) given an address. The following code sequence and call to obtains an address given a symbol name. SEE ALSO
kmem(7). getksym(2)
All times are GMT -4. The time now is 10:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy