Much faster with "sed". Also by using "while read" rather than "for" we preserve each record intact:
Note the double quotes round the string variable $line.
Hi,
I am a beginner in shell scripting. I have written the following script, which is supposed to process the while loop for each line in the sid_home.txt file. But I'm getting the 'end of file' unexpected for the last line. The file sid_home.txt gets generated as expected, but the script... (6 Replies)
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)
I know how to read a file line by line. But don't to how to skip to a line matching a criteria and then continue reading it till the end.
This is a log file. The input is a timestamp.
1. Find the timestamp in the log file
2. Read the remaining lines one at a time till EOF.
How can I do... (9 Replies)
I need some help. I would like to read in a text file.
Take a variable such as ROW-D-01, compare it to what's in one line in the text file such as PROD/VM/ROW-D-01 and only input PROD/VM into a variable without the /ROW-D-01.
Is this possible? any help is appreciated. (2 Replies)
Hi,
I want to read a live log file line by line and considering those line which start from time stamp;
Below code I am using, which read line but throws an exception when comparing line that does not contain error code
tail -F /logs/COMMON-ERROR.log | while read myline; do... (2 Replies)
Hi All,
Am trying to write wrapper shell/bash script on a utility tool for which i need to pass 2 files as arugment to execute utility tool.
Wraper script am trying is to do with above metion 2 files.
utility tool accepts :
a. userinfo file : which contains username
b. item file : which... (2 Replies)
Hi All,
I am using UNix Sun OS sun4u sparc SUNW,SPARC-Enterprise
My intention is to insert a line of text after 13th line of every file inside a particular directory.
While trying to do it for a single file , i am using sed
sed '3 i this is the 4th line' filename
sed: command garbled: 3... (5 Replies)
My file (the output of an experiment) starts off looking like this,
_____________________________________________________________
Subjects incorporated to date: 001
Data file started on machine PKSHS260-05CP
**********************************************************************
Subject 1,... (9 Replies)
Hi All,
i want to write a shell script read below file line by line and want to exclude the lines which contains empty value for MOUNTPOINT field.
i am using centos 7 Operating system.
want to read below file.
# cat /tmp/d5
NAME="/dev/sda" TYPE="disk" SIZE="60G" OWNER="root"... (4 Replies)
Discussion started by: balu1234
4 Replies
LEARN ABOUT OSX
memory_pressure
MEMORY_PRESSURE(1) BSD General Commands Manual MEMORY_PRESSURE(1)NAME
memory_pressure -- Tool to apply real or simulate memory pressure on the system.
SYNOPSIS
memory_pressure [-l level] | [-p percent_free] | [-S -l level]
OPTIONS -l <level> Apply real or simulate memory pressure (if specified alongside simulate argument) on the system till low memory notifications cor-
responding to <level> are generated. Supported values are "warn" and "critical".
-p <percent_free> Allocate memory till the available memory in the system is <percent_free> of total memory. If the percentage of available
memory to total memory on the system drops, the tool will free memory till either the desired percentage is achieved or it runs out of memory
to free.
-S Simulate memory pressure on the system by placing it artificially for <sleep_seconds> duration at the "warn" or "critical" level.
-s <sleep_seconds> Duration to wait before allocating or freeing memory if applying real pressure. In case of simulating memory pressure,
this is the duration the system will be maintained at an artifical memory level.
DESCRIPTION
A tool to apply real or simulate memory pressure on the system
SEE ALSO vm_stat(1)Mac OS X Mar 7, 2013 Mac OS X