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
log(n)								 Logging facility							    log(n)

__________________________________________________________________________________________________________________________________________________

NAME
log - Procedures to log messages of libraries and applications. SYNOPSIS
package require Tcl 8 package require log ?1.2.1? ::log::levels ::log::lv2longform level ::log::lv2color level ::log::lv2priority level ::log::lv2cmd level ::log::lv2channel level ::log::lvCompare level1 level2 ::log::lvSuppress level {suppress 1} ::log::lvSuppressLE level {suppress 1} ::log::lvIsSuppressed level ::log::lvCmd level cmd ::log::lvCmdForall cmd ::log::lvChannel level chan ::log::lvChannelForall chan ::log::lvColor level color ::log::lvColorForall color ::log::log level text ::log::logarray level arrayvar ?pattern? ::log::loghex level text data ::log::logMsg text ::log::logError text ::log::Puts level text _________________________________________________________________ DESCRIPTION
The log package provides commands that allow libraries and applications to selectively log information about their internal operation and state. To use the package just execute package require log log::log notice "Some message" As can be seen above, each message given to the log facility is associated with a level determining the importance of the message. The user can then select which levels to log, what commands to use for the logging of each level and the channel to write the message to. In the following example the logging of all message with level debug is deactivated. package require log log::lvSuppress debug log::log debug "Unseen message" ; # No output By default all messages associated with an error-level (emergency, alert, critical, and error) are written to stderr. Messages with any other level are written to stdout. In the following example the log module is reconfigured to write debug messages to stderr too. package require log log::lvChannel debug stderr log::log debug "Written to stderr" Each message level is also associated with a command to use when logging a message with that level. The behaviour above for example relies on the fact that all message levels use by default the standard command ::log::Puts to log any message. In the following example all mes- sages of level notice are given to the non-standard command toText for logging. This disables the channel setting for such messages, assum- ing that toText does not use it by itself. package require log log::lvCmd notice toText log::log notice "Handled by "toText"" Another database maintained by this facility is a map from message levels to colors. The information in this database has no influence on the behaviour of the module. It is merely provided as a convenience and in anticipation of the usage of this facility in tk-based applica- tion which may want to colorize message logs. API
The following commands are available: ::log::levels Returns the names of all known levels, in alphabetical order. ::log::lv2longform level Converts any unique abbreviation of a level name to the full level name. ::log::lv2color level Converts any level name including unique abbreviations to the corresponding color. ::log::lv2priority level Converts any level name including unique abbreviations to the corresponding priority. ::log::lv2cmd level Converts any level name including unique abbreviations to the command prefix used to write messages with that level. ::log::lv2channel level Converts any level name including unique abbreviations to the channel used by ::log::Puts to write messages with that level. ::log::lvCompare level1 level2 Compares two levels (including unique abbreviations) with respect to their priority. This command can be used by the -command option of lsort. The result is one of -1, 0 or 1 or an error. A result of -1 signals that level1 is of less priority than level2. 0 signals that both levels have the same priority. 1 signals that level1 has higher priority than level2. ::log::lvSuppress level {suppress 1} ] (Un)suppresses the output of messages having the specified level. Unique abbreviations for the level are allowed here too. ::log::lvSuppressLE level {suppress 1} ] (Un)suppresses the output of messages having the specified level or one of lesser priority. Unique abbreviations for the level are allowed here too. ::log::lvIsSuppressed level Asks the package whether the specified level is currently suppressed. Unique abbreviations of level names are allowed. ::log::lvCmd level cmd Defines for the specified level with which command to write the messages having this level. Unique abbreviations of level names are allowed. The command is actually a command prefix and this facility will append 2 arguments before calling it, the level of the mes- sage and the message itself, in this order. ::log::lvCmdForall cmd Defines for all known levels with which command to write the messages having this level. The command is actually a command prefix and this facility will append 2 arguments before calling it, the level of the message and the message itself, in this order. ::log::lvChannel level chan Defines for the specified level into which channel ::log::Puts (the standard command) shall write the messages having this level. Unique abbreviations of level names are allowed. The command is actually a command prefix and this facility will append 2 arguments before calling it, the level of the message and the message itself, in this order. ::log::lvChannelForall chan Defines for all known levels with which which channel ::log::Puts (the standard command) shall write the messages having this level. The command is actually a command prefix and this facility will append 2 arguments before calling it, the level of the message and the message itself, in this order. ::log::lvColor level color Defines for the specified level the color to return for it in a call to ::log::lv2color. Unique abbreviations of level names are allowed. ::log::lvColorForall color Defines for all known levels the color to return for it in a call to ::log::lv2color. Unique abbreviations of level names are allowed. ::log::log level text Log a message according to the specifications for commands, channels and suppression. In other words: The command will do nothing if the specified level is suppressed. If it is not suppressed the actual logging is delegated to the specified command. If there is no command specified for the level the message won't be logged. The standard command ::log::Puts will write the message to the channel specified for the given level. If no channel is specified for the level the message won't be logged. Unique abbreviations of level names are allowed. Errors in the actual logging command are not caught, but propagated to the caller, as they may indicate miscon- figurations of the log facility or errors in the callers code itself. ::log::logarray level arrayvar ?pattern? Like ::log::log, but logs the contents of the specified array variable arrayvar, possibly restricted to entries matching the pat- tern. The pattern defaults to * (i.e. all entries) if none was specified. ::log::loghex level text data Like ::log::log, but assumes that data contains binary data. It converts this into a mixed hex/ascii representation before writing them to the log. ::log::logMsg text Convenience wrapper around ::log::log. Equivalent to ::log::log info text. ::log::logError text Convenience wrapper around ::log::log. Equivalent to ::log::log error text. ::log::Puts level text The standard log command, it writes messages and their levels to user-specified channels. Assumes that the suppression checks were done by the caller. Expects full level names, abbreviations are not allowed. LEVELS
The package currently defines the following log levels, the level of highest importance listed first. o emergency o alert o critical o error o warning o notice o info o debug BUGS, IDEAS, FEEDBACK This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category log of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have for either package and/or documentation. KEYWORDS
log, log level, message, message level COPYRIGHT
Copyright (c) 2001-2008 Andreas Kupries <andreas_kupries@users.sourceforge.net> log 1.2.1 log(n)
All times are GMT -4. The time now is 12:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy