Sponsored Content
Top Forums UNIX for Beginners Questions & Answers How to add space in front of cat values? Post 303004892 by Scott on Tuesday 10th of October 2017 11:29:07 AM
Old 10-10-2017
Not sure I totally follow. Some punctuation would not go a miss ;-)

Code:
$ sed "s/^/  /" t.txt
  1,/level1/level2/CAP_data.171002/20171002_060344_53608614,20171002_060344_53608614
  2,/level1/level2/20171005_023901_56688702,20171005_023901_56688702
  3,/level1/level2/20171005_023903_13697660,20171005_023903_13697660
  4,/level1/level2/20171005_023905_33947650,20171005_023905_33947650
  5,/level1/level2/20171005_023906_11666112,20171005_023906_11666112
  6,/level1/level2/20171005_023908_49545338,20171005_023908_49545338
  7,/level1/level2/20171005_023911_18875126,20171005_023911_18875126
  8,/level1/level2/20171005_023913_36372644,20171005_023913_36372644
  9,/level1/level2/20171005_023915_3539570,20171005_023915_3539570

(no need for cat)
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

cat: write error: No space left on device

I am trying to create new files under my directory...but i getting the following message... cat: write error: No space left on device How do we handle this error. I am not getting this error when I login as the super user (3 Replies)
Discussion started by: igandu
3 Replies

2. Shell Programming and Scripting

remove space in front or end of each field

Hi, I have a txt file called a.txt which contain over 10,000 records and I would like to remove space before comma or after comma....like below: The input (for example two record 00001,00002): 00001,client,card limited ,02292,N ,162:41 , 192, ... (6 Replies)
Discussion started by: happyv
6 Replies

3. Shell Programming and Scripting

Have a basic 'for i in cat list' - Trying to get i to be set to a name with a space

Hi Have a file called ldap.list: ****** "o=unix forum" o=groups ****** i wrote a basic script that runs: for i in `cat ldap.list` do ldapsearch -h host -p 389 -b $i THE PROBLEM: - It looks like when the for i in cat ldap.list runs, it doesn't seem to care about the " ", it... (2 Replies)
Discussion started by: littlefrog
2 Replies

4. Shell Programming and Scripting

problem in using cat and ended up with no space error in aix

While doing cat on a large file (3 GB file) , I am getting the no space error in the shell script hugefile.sh. Eg: for i in `cat hugefile.txt` do echo "$i" done error: hugefile.sh: no space Please let me know your thoughts in handling this no space issue. (2 Replies)
Discussion started by: techmoris
2 Replies

5. Shell Programming and Scripting

How join line and add | in front

Hello, Did any one know how to use perl join line and add | in front Input--> timestamp=2009-11-10-04.55.20.829347; a; b; c; ddaa; timestamp=2009-11-10-04.55.20.829347; aa; bb; cc; Output--> ... (2 Replies)
Discussion started by: happyday
2 Replies

6. Shell Programming and Scripting

Cat Values from Several files if it meets criteria for column values

I have results from some statistical analyses. The format of the results are as given below: I want to select lines that have a p-value (last column) less than 0.05 from all the results files (*.results) and cat to a new results file. It would be very nice if a new column is added that tells... (2 Replies)
Discussion started by: genehunter
2 Replies

7. Shell Programming and Scripting

Want non-interpretation of blank space using cat

I have a file say ADCD which is like following--> Please consider 'z' as space #cat ADCD <!--Yzzz|z--> <!--Nzzzzz--> Now I want to store the content of this file to a variable say VAR like this--> #VAR=`cat ADCD` #echo $VAR <!--Yz|z--> <!--Nz--> Now I don' t want the variable... (2 Replies)
Discussion started by: muchyog
2 Replies

8. Shell Programming and Scripting

Moving cat values to a variable

I have a file created as ABC!DEF@2014.txt My if condition is based on 2014 so I need to move it to variable. So while I can do this on console screen - ls ABC* -l > test.txt cat test.txt | cut -f 2 -d "@" | cut -f 1 -d "." to get the value - 2014 I am a bit at loss how to achieve this... (4 Replies)
Discussion started by: rajiv_kool
4 Replies

9. Linux

How to add \ in front of $ in a script with vi?

Please help to provide command in vi to add \ in front of $ so it does not interpret next character. rm interfaces/DART/WEB-INF/classes/DART/util/TotalDisconnectUtil$1.class rm interfaces/DART/WEB-INF/classes/DART/util/TotalDisconnectUtil$2.class rm... (3 Replies)
Discussion started by: ywu081006
3 Replies

10. Shell Programming and Scripting

Add text in front of variable

I am just trying to add specific text in front of a ${variant} but can not seem to get the syntax correct. I have tried sed -i '$a NM_004004.5' ${variant} and printf "NM_004004.5:%s\n" ${variant} with no luck. Thank you :). (7 Replies)
Discussion started by: cmccabe
7 Replies
PCRESAMPLE(3)						     Library Functions Manual						     PCRESAMPLE(3)

NAME
PCRE - Perl-compatible regular expressions PCRE SAMPLE PROGRAM
A simple, complete demonstration program, to get you started with using PCRE, is supplied in the file pcredemo.c in the PCRE distribution. The program compiles the regular expression that is its first argument, and matches it against the subject string in its second argument. No PCRE options are set, and default character tables are used. If matching succeeds, the program outputs the portion of the subject that matched, together with the contents of any captured substrings. If the -g option is given on the command line, the program then goes on to check for further matches of the same regular expression in the same subject string. The logic is a little bit tricky because of the possibility of matching an empty string. Comments in the code explain what is going on. If PCRE is installed in the standard include and library directories for your system, you should be able to compile the demonstration pro- gram using this command: gcc -o pcredemo pcredemo.c -lpcre If PCRE is installed elsewhere, you may need to add additional options to the command line. For example, on a Unix-like system that has PCRE installed in /usr/local, you can compile the demonstration program using a command like this: gcc -o pcredemo -I/usr/local/include pcredemo.c -L/usr/local/lib -lpcre Once you have compiled the demonstration program, you can run simple tests like this: ./pcredemo 'cat|dog' 'the cat sat on the mat' ./pcredemo -g 'cat|dog' 'the dog sat on the cat' Note that there is a much more comprehensive test program, called pcretest, which supports many more facilities for testing regular expres- sions and the PCRE library. The pcredemo program is provided as a simple coding example. On some operating systems (e.g. Solaris), when PCRE is not installed in the standard library directory, you may get an error like this when you try to run pcredemo: ld.so.1: a.out: fatal: libpcre.so.0: open failed: No such file or directory This is caused by the way shared library support works on those systems. You need to add -R/usr/local/lib (for example) to the compile command to get round this problem. AUTHOR
Philip Hazel University Computing Service Cambridge CB2 3QH, England. REVISION
Last updated: 23 January 2008 Copyright (c) 1997-2008 University of Cambridge. PCRESAMPLE(3)
All times are GMT -4. The time now is 03:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy