Sponsored Content
Top Forums Shell Programming and Scripting Cut last 13 characters and take the rest of the file name Post 302522930 by Tytalus on Tuesday 17th of May 2011 06:35:02 AM
Old 05-17-2011
you're not a mile off....tweaking your code:

Code:
#  echo A.DAT20110517033732 | awk '{print substr($0,1,length($0)-14)}'
A.DAT

are you wanting to always strip the last 13 chars ? (above is reasonable....many other ways though :-) )

or everything after DAT
Code:
#   echo A.DAT20110517033732 | sed 's/\(.*.DAT\).*/\1/'
A.DAT

or any trailing numerics
Code:
#   echo A.DAT20110517033732 | sed 's/[0-9]*$//'
A.DAT

HTH
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

cut first 4 characters from a line

Please let me know how to cut first four characters from a line in UNIX after grepping the file.. (5 Replies)
Discussion started by: kaushikraman
5 Replies

2. Shell Programming and Scripting

how to cut first 3 characters of each line in a file

Hi Friends I have a file like sample1.txt ------------ 10998909.txt 10898990.txt 1898772222.txt 8980000000000.txt I need to take first 3 characters of each line in a file and i need to print it ' like loop 109 108 189 898 (7 Replies)
Discussion started by: kittusri9
7 Replies

3. Shell Programming and Scripting

cut 1st 2 characters off all line1st in file

I know this sounds simple, but I have a logfile with > something > something_else > another_entry ... how do I cut the first 2 characters off the left side? I tried to use cut -c 1-2 somefile > someotherfile but that just cut gave me the 2 left characters, I want to cut those out... (2 Replies)
Discussion started by: unclecameron
2 Replies

4. Shell Programming and Scripting

cut between characters of a file

Hi All, Need to convert file names to upper case using tr command in Unix. In a folder -> /apps/dd01/misc there are two files like: pi-abcd567sd.pdf pi-efgh1.pdf The output of should be like: pi-ABCD567SD.pdf pi-EFGH1.pdf I have used the command to work as below: for f... (3 Replies)
Discussion started by: a1_win
3 Replies

5. Shell Programming and Scripting

Need to cut first 21 and 32-25 characters from file

Guys, can you help me in doing cut first 21 and 32-35 characters from file. I tried with cut -c to cut first 21 characters ,It is succeeded. But i need both first 21 and 32-35. (1 Reply)
Discussion started by: mohan_xunil
1 Replies

6. AIX

How to cut a flat file according to a certain number of characters?

hello everybody i am looking for a shell to cut a flat file (with a long unique line) according to a certain number of characters and redirect every result to an output file. here is an example MyFile : 12 3 456 12 3 456 12 3 456 ..... and i took every 9-characters including BLANKS... (6 Replies)
Discussion started by: fastlane3000
6 Replies

7. Shell Programming and Scripting

Cut the last 15 characters off

Hi Gurus, I am trying to execute the below command. However the output shows the value + path of the folder where the command is being executed. But I am only interested in the value but not the path. du -hs /aps/inf/SeLogs when I execute the above command, output is 32G... (5 Replies)
Discussion started by: svajhala
5 Replies

8. Shell Programming and Scripting

Cut last 7 characters of a variable

I need to cut the last seven characters of a variable length variable. The variable may be 7 characters or 70. I need to always be able to grab the last 7 characters. I looked at the cut command but it always seems to want to start at the beginning of a line, not the end and count backwards. ... (5 Replies)
Discussion started by: kblawson14
5 Replies

9. Shell Programming and Scripting

cut certain characters for each line in a file

Hi Everyone, i have a file 1.txt <a><a"" dd>aaaaauweopriuew</f><">!(^)!</aa></ff> <a><a"" dd>bbbbbuweopriuew</f><">!(^*)!</aa></ff> i know i can use perl -p -i -e "s/>aaaaa/aa/g" 1.txt perl -p -i -e "s/>bbbbb/bb/g" 1.txt to acheive only keep the first two characters of the five characters,... (4 Replies)
Discussion started by: jimmy_y
4 Replies

10. Shell Programming and Scripting

Cut the first 100 characters of file

Hello all, I have a file and would like to cut the first 100 characters of the first line. I tried it with the ‘cut’-command: cut –c100- $file > $file.tmp But this does not work, because it will cut the first 100 characters of each line. But I need to cut them only from the beginning of... (6 Replies)
Discussion started by: API
6 Replies
OGGCUT(1)							   User Manuals 							 OGGCUT(1)

NAME
oggCut - extracts parts of an ogg file (.ogv, .ogg and .oga) SYNOPSIS
oggCut [options] inputfile outputfile DESCRIPTION
oggCut creates a new ogg file named outputfile as a subpart of the original file named inputfile oggCut is able to cut video (theora) only files, audio (vorbis) only files or files with both video and audio streams. The start and end time for the cut area must be given in milliseconds with the options -s and -e. As a video stream consists of I-frames (which are full pictures) and P-frames (which are delta pictures to the leading I-frame) the oggCut algorithm searches for the first I-frame. If a video file would start with a p-frame, the player is not able to interpret this picture, as the leading I-frame (on where it is based) is not available. oggCut starts the I-frame search at the start time given by the -s option. So expect a shorter video time than the calculated seconds for the new file. oggCut does not do any reencoding, therefore the output quality is completely the same as from the input file. For those involved into the ogg container format: The file is cut on packet basis, not on page basis. There is another tool called oggCut out in the internet with a different synopis. This one has not been written by the author of this tool you are actually using. OPTIONS
-s Cut start position in ms. If the input file is a video file, the cut area starts with the next keyframe found. Default: 0 Example: -s 5000 -l Length of the cut area in ms. If -e is also given, the length is ignored. Example: -l 10000 -e Cut end position in ms. If -l is also used, the end position is prefered. If the end position is set to -1, the end of the stream is assumed. Default: -1 Example: -e 20000 EXAMPLE
oggCut -s 1000 -e 21000 myVideo.ogv myOutput.ogv Creates a new video called myOutput.ogv from the video myVideo.ogv starting after 1 second ending after 21 seconds AUTHOR
Joern Seger <yorn at gmx dot net> SEE ALSO
oggCat(1), oggJoin(1), oggSplit(1), oggTranscode(1), oggSlideshow(1), oggThumb(1), oggSilence(1) Linux JAN 2010 OGGCUT(1)
All times are GMT -4. The time now is 05:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy