solved - removing last n char in every line


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers solved - removing last n char in every line
# 8  
Old 08-04-2010
thanks all for the help.

Code:
sed "s/.\{${CNT}\}$//" infile #satisfied my requirement.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

[Solved] Modifying/Removing Timestamps from a filename

So given filenames of varying lengths, I was wondering how I would remove or modify appended timestamps of the current date DD-MM-YY. So say: test_DD-MM-YY.txt coolbeans_DD-MM-YY.pdf And what I expect the output to be: test.txt coolbeans.pdf Thanks :) (2 Replies)
Discussion started by: sodaboyz
2 Replies

2. Shell Programming and Scripting

How to separate one line to mutiple line based on one char?

Hi Gurus, I need separate one file which is one huge line to mutiple line. file like abcd # bcd # def # fge # ged I want to get abcd bcd def fge ged Thanks in advance (4 Replies)
Discussion started by: ken6503
4 Replies

3. UNIX for Dummies Questions & Answers

[Solved] Removing an 8 character string

Edit: Figured it out. Close the thread please. Solution: \{8}\] edit by bakunin: no need to close the thread, but i changed the title to SOLVED. Thanks for writing a follow-up. (0 Replies)
Discussion started by: unknownn
0 Replies

4. Programming

C++ Removing = from char*

I have a char* str. Suppose str="medium"; I want to check if str has "=" as first non blank position, if it exists, I want to remove it Currently I am checking using if (optarg == '=') cout << "Found =" << endl; (2 Replies)
Discussion started by: kristinu
2 Replies

5. Shell Programming and Scripting

Formatting File having big single line into 95 Char Per Line

Hi All, I have 4 big files which contains one big line containing formatted character records, I need to format each file in such way that each File will have 95 Characters per line. Last line of each file will have newline character at end. Before:- File Name:- File1.dat 102 121340560... (10 Replies)
Discussion started by: lancesunny
10 Replies

6. UNIX for Dummies Questions & Answers

[solved]removing characters from a mass of file names

I found a closed thread that helped quite a bit. I tried adding the URL, but I can't because I don't have enough points... ? Modifying the syntax to remove ! ~ find . -type f -name '*~\!]*' | while IFS= read -r; do mv -- "$REPLY" "${REPLY//~\!]}"; done These messages are... (2 Replies)
Discussion started by: rabidphilbrick
2 Replies

7. UNIX for Dummies Questions & Answers

[Solved] Help with using tr - Removing white spaces

Hi, I have a file that contains whitespaces with spaces and spaces and tabs on each line and am wanting to remove the whitespaces. My version of sed is one that does not recognize \t etc. The sed and awk one-liners below that I found via Google both does not work. So my next best... (3 Replies)
Discussion started by: newbie_01
3 Replies

8. Shell Programming and Scripting

[Solved] Problem in reading a file line by line till it reaches a white line

So, I want to read line-by-line a text file with unknown number of files.... So: a=1 b=1 while ; do b=`sed -n '$ap' test` a=`expr $a + 1` $here do something with b etc done the problem is that sed does not seem to recognise the $a, even when trying sed -n ' $a p' So, I cannot read... (3 Replies)
Discussion started by: hakermania
3 Replies

9. Shell Programming and Scripting

Removing special char's with sed

Hi, I've a txt file which contains the following kind of listed data 18971 ./aosrp18.r 15340 ./aosrp12.r 22996 ./aosrp08.r 17125 ./aosrp06.r I'm trying to get rid of the ./ in the file and have tried the following with sed but I'm not getting the correct result... I'm not sure what way... (7 Replies)
Discussion started by: Jazmania
7 Replies

10. Shell Programming and Scripting

how first char in odd line and second char in even line

Hi I m having ifconfig -a o/p like sbanlab1:ksh# ifconfig -a | egrep "flags|inet" | awk -F' ' '{print $1,$2}' lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> inet 127.0.0.1 lo0:1: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> inet 127.0.0.1 bge0:... (1 Reply)
Discussion started by: tarunn.dubeyy
1 Replies
Login or Register to Ask a Question
gdcmgendir(1)							       GDCM							     gdcmgendir(1)

NAME
gdcmgendir - Tool to generate a DICOMDIR file from a File-Set. SYNOPSIS
gdcmgendir [options] file-in file-out DESCRIPTION
PARAMETERS
file-in DICOM input filename file-out DICOM output filename options Parameters options -i --input DICOM filename or directory -o --output DICOM filename or directory -r --recursive recursive. --descriptor descriptor. --root-uid Root UID. general options -h --help print this help text and exit -v --version print version information and exit -V --verbose verbose mode (warning+error). -W --warning warning mode, print warning information -E --error error mode, print error information -D --debug debug mode, print debug information environment variable GDCM_ROOT_UID Root UID Typical usage NOTE
One may have to run some preliminary steps in order to get gdcmgendir to generate the DICOMDIR file. Namely two steps: o Batch renaming of the DICOM filename into something compatible with ISO 9660 filename convention o Convert all DICOM file into the Explicit VR Little Endian Uncompressed (1.2.840.10008.1.2.1) Step 1. can be solved in a numerous way. Eg. on UNIX environment this could either be solved using the mkisofs command line tool. filename should not contains any extension since the VR CS does not allow for the '.' character. Only upper case, digit 0-9, the space ' ' and the underscore '_' character are valid in VR CS, with a maximum of 8 bytes. Another simple tool that can be handy is 'rename' in conjunction with 'basename'. Step 2. can simply be achieved using the gdcmconv command line tool: $ for i in `ls IMG*`; do gdcmconv --raw --force $i /tmp/out/$i; done SEE ALSO
gdcmconv(1), gdcmanon(1), rename(1) COPYRIGHT
Copyright (c) 2006-2011 Mathieu Malaterre Version 2.2.0 Tue Feb 5 2013 gdcmgendir(1)