Cut string substr


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Cut string substr
# 1  
Old 12-17-2015
Cut string substr

friends

as I can cut the first three characters in a string example:


Code:
400_FACTURACION_CANJES_20151217.txt

Result

400

# 2  
Old 12-17-2015
cut -c1-3
This User Gave Thanks to RudiC For This Post:
# 3  
Old 12-17-2015
Quote:
Originally Posted by RudiC
cut -c1-3
thank you!!!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Cut only time from string

Hi Guys, I have following different lines separated by multiple spaces. And i need to cut only the time part (16:53) from the string. How can we achieve it? remedy 29210 1 1 07:55 ? 00:06:20 /opt/bmc/java/jre1.6.0_17/bin/java -Xms1024m -Xmx2048m -XX:MaxPermSize=1024m... (12 Replies)
Discussion started by: Khushbu
12 Replies

2. Shell Programming and Scripting

Cut the string

---------- Post updated at 10:31 AM ---------- Previous update was at 10:28 AM ---------- Hello, I am trying to get the string cut based on the following needs: String1=Submitted request 25574824 for CONCURRENT SQLAP RUAPACTUALSEXT Y RUAPACTUALS122313100616.dat "2013/01/12 14:50:44"... (6 Replies)
Discussion started by: cartrider
6 Replies

3. Shell Programming and Scripting

Cut a string for last 8 characters

Hello All I have a file like this abc.tpt.ctl bdc.tpt.ctl cdw.tpt.ctl I have looped every line using the for Loop, now I want to take each line and cut the .tpt.ctl part of it and store it in a variable and use the variable in same loop. The part I am stuck at is how do I cut the last... (9 Replies)
Discussion started by: nnani
9 Replies

4. Shell Programming and Scripting

Cut the string

Hi in a directory i've files having the following name for_category_info_19990101984301 for_catgry_meta_19991111214601 ------- I just want the name till year and month i.e; for_category_info_199901 for_catgry_meta_199911 How can i achieve the above string Thanks (2 Replies)
Discussion started by: smile689
2 Replies

5. Shell Programming and Scripting

Cut line up to a string

hi all In my bash script I want to cut a line up to a specific string and keep the rest of it but only up to a ".How can I do that?I imagine something with sed.. Let's say my line is: Jennifer Jones (student) "id:376765748587/7465674775" NewYork and i only want to keep: ... (9 Replies)
Discussion started by: vlm
9 Replies

6. Shell Programming and Scripting

how to cut all string after the last delimiter?

hi all, suppose a string: abc/def/ghi/jkl/mn.txt and i want to get the file name without the path. however, different files have different paths, therefore the number of delimiter is uncertain. thanks so much! (3 Replies)
Discussion started by: sunnydanniel
3 Replies

7. Shell Programming and Scripting

Scripting help- cut the string

Hi I am having a file with the following content(its created by ls of a directory): -rw-r----- 1 321 321 0 Oct 14 10:41 xcv23456 -rw-r----- 1 321 321 0 Oct 14 10:41 xcv23457 -rw-r----- 1 321 321 0 Oct 14 10:41 xcv23458 -rw-r----- 1 321 321 ... (6 Replies)
Discussion started by: digitalage
6 Replies

8. Shell Programming and Scripting

copy substr in existing string in Perl

Any clue to write something to a particular location in Perl? Suppose $line = ‘abc cde 1234” How to write ( example string "test") on location 4 without parsing the whole line. Output should be $line = ‘abctest 1234” this is not search and replace. just to add substring into... (3 Replies)
Discussion started by: jaivipin
3 Replies

9. Shell Programming and Scripting

substr from a string in Shell script

Shell Scripting Gurus, I am having a hard time :confused: trying to figure out what I am doing wrong in my script. Below is the script snippet. It gives an error when it tries to execute the expression. a=`expr substr $stringZ 5 10` #!/bin/bash echo "Hello" stringZ="abcABC123ABCabc"... (3 Replies)
Discussion started by: yajaykumar
3 Replies

10. Shell Programming and Scripting

read string, check string length and cut

Hello All, Plz help me with: I have a csv file with data separated by ',' and optionally enclosed by "". I want to check each of these values to see if they exceed the specified string length, and if they do I want to cut just that value to the max length allowed and keep the csv format as it... (9 Replies)
Discussion started by: ozzy80
9 Replies
Login or Register to Ask a Question