Sponsored Content
Top Forums Shell Programming and Scripting AWK with allow me to add spaces Post 302173706 by rbulus on Friday 7th of March 2008 02:45:30 PM
Old 03-07-2008
Bug AWK with allow me to add spaces

I have a file like this:
running:running since Mon Mar 3 09:46:19 2008:
running:running since Thu Mar 6 22:36:51 2008:
running:running since Tue Dec 4 00:34:15 2007:
running:running since Tue Dec 4 00:34:16 2007:
running:running since Mon Jan 21 11:15:04 2008:
running:running since Mon Jan 21 11:15:12 2008:

This is a log file, it creates everyday some log. I want to search for the specific day of yesterday.

date | awk '{ print $2 , $3-1}'

The answer will be: Mar 6

This awk has the a problem with this. If you see in my log file, "Mar" is 2 spaces from 6, not one like the awk show. How can i add one space to this file, I tried with "\t" but it does not work like i need.

Rbulus
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Add spaces between Characters

I need to add spaces in between characters in a string variable. Is there a shortcut? I know you can remove the spaces with sed, but does sed have a way to add them? Example: I have: DATA01 I want it to be: D A T A 0 1 What I have done so far is to create a function... (4 Replies)
Discussion started by: heyindy06
4 Replies

2. Shell Programming and Scripting

Help with awk adding spaces.

I have a file that contains... elm,mail elm,lisp,composer,cd,ls,cd,ls,cd,ls,zcat,|,tar,-xvf,ls,cd,ls,cd,ls,vi,ls,cd,ls,vi,elm,-f,ls,rm,ls,cd,ls,vi,vi,ls,vi,ls,cd,ls,elm,cd,ls,cd,ls,vi,vi,vi,ls,vi,ls,i,vi,ls,cp,cd,fg,ls,rm,cd,ls,-l,exit elm,mail,biff,elm,biff,elm,elm elm,ls ... (2 Replies)
Discussion started by: Bandit390
2 Replies

3. Shell Programming and Scripting

can v add 'n' of spaces by a single command?

Hi All, I just need to check for 'tabs' in my input file and need to replace all tabs into 'n' no. of spaces. Say for example if I give NO_OF_SPACE=5, then it should replace all tabs with 5 spaces abc.in ##### asdasdasd \t\t\tasjkalskdl;asdsdjfksldfjklsdfxcmxm,cv... (2 Replies)
Discussion started by: askumarece
2 Replies

4. UNIX for Dummies Questions & Answers

VIM add white spaces

Hello, How do I adda two whitespaces at the begining of each lines between line 12 and line 90; something like :12,90 ??? Thanks! (3 Replies)
Discussion started by: JCR
3 Replies

5. Shell Programming and Scripting

add semicolumn and remove spaces

Hi I have a file like: one two three four five six seven eight nine ten and I'd like to get one:two:three:four:five I'm trying to do it with sed, but the problem is also that the spaces between the words are not constant. Any idea please? thanks ... (5 Replies)
Discussion started by: Dedalus
5 Replies

6. Shell Programming and Scripting

awk and spaces in filenames

Hey there, this is my first post and I'll try to explain my situation as best I can.Here is a sample of the input file: ADO Sample.h,v ADO Sample 2010-05-21 lyonsb /repository/patents/TSCommon/OpenSource/Dundass/ug6mfc/DataSources/Ado/ADO Sample ADO SampleDoc.h,v ADO SampleDoc 2010-05-21... (3 Replies)
Discussion started by: rodan90
3 Replies

7. Shell Programming and Scripting

awk for removing spaces

HI, I have a file with lot of blank lines, how can I remove those using awk?? Thanks, Shruthi (4 Replies)
Discussion started by: shruthidwh
4 Replies

8. Shell Programming and Scripting

Add spaces when x-coordinate changes with Awk

I have a tab-delimited file with three columns. They are arranged in blocks like this 1 1 8 1 2 3 1 3 7 1 4 4 1 5 7 2 1 9 2 2 4 ... I would like to add spaces so that the file looks like this: 1 1 8 1 2 3 1 3 7 1 4 4 1 5 7 (3 Replies)
Discussion started by: machinus
3 Replies

9. UNIX for Dummies Questions & Answers

Want to add trailing spaces to the variable

I want to keep string/varible length to 10 even its actual length is less than 10(may be no value). so, i want to add trailing spaces to my string. :wall: "typeset -L10 myvarible" is not working, its saying invalid typset -L option. Can you please advise. (4 Replies)
Discussion started by: djaks111
4 Replies

10. UNIX for Dummies Questions & Answers

Add spaces to variable

Hi, I'm passing a variable to a scrpit which can be 1 to 3 characters long. How can I force it to be three character long and add spaces to it? The passed variable is stored in $1 and I would like to be stored in NewName I tried without success NewName=$(printf "%*s 3 $1) So if... (2 Replies)
Discussion started by: f_o_555
2 Replies
platform::shell(n)					       Tcl Bundled Packages						platform::shell(n)

__________________________________________________________________________________________________________________________________________________

NAME
platform::shell - System identification support code and utilities SYNOPSIS
package require platform::shell ?1.1.4? platform::shell::generic shell platform::shell::identify shell platform::shell::platform shell _________________________________________________________________ DESCRIPTION
The platform::shell package provides several utility commands useful for the identification of the architecture of a specific Tcl shell. This package allows the identification of the architecture of a specific Tcl shell different from the shell running the package. The only requirement is that the other shell (identified by its path), is actually executable on the current machine. While for most platform this means that the architecture of the interrogated shell is identical to the architecture of the running shell this is not generally true. A counter example are all platforms which have 32 and 64 bit variants and where a 64bit system is able to run 32bit code. For these running and interrogated shell may have different 32/64 bit settings and thus different identifiers. For applications like a code repository it is important to identify the architecture of the shell which will actually run the installed packages, versus the architecture of the shell running the repository software. COMMANDS
platform::shell::identify shell This command does the same identification as platform::identify, for the specified Tcl shell, in contrast to the running shell. platform::shell::generic shell This command does the same identification as platform::generic, for the specified Tcl shell, in contrast to the running shell. platform::shell::platform shell This command returns the contents of tcl_platform(platform) for the specified Tcl shell. KEYWORDS
operating system, cpu architecture, platform, architecture platform::shell 1.1.4 platform::shell(n)
All times are GMT -4. The time now is 03:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy